diff options
| author | yui-knk <spiketeika@gmail.com> | 2024-04-07 10:59:51 +0900 |
|---|---|---|
| committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-04-15 06:29:25 +0900 |
| commit | 515e52a0b1ce61ccaffe9183bcb78dda95a64907 (patch) | |
| tree | 7b44099cd101906521f9e0717779892ef88f68bd /test | |
| parent | 339128b190959ce15de2b3cecbf9c5ac3c402a1b (diff) | |
Emit `warn` event for duplicated hash keys on ripper
Need to use `rb_warn` macro instead of calling `rb_compile_warn`
directly to emit `warn` event on ripper.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ripper/test_parser_events.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 0bad60b259..cbae6e7ed5 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -1686,6 +1686,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase assert_equal([3], args) end + def test_warn_duplicated_hash_keys + fmt, *args = warn("{ a: 1, a: 2 }") + assert_match(/is duplicated and overwritten on line/, fmt) + assert_equal([:a, 1], args) + end + def test_warn_cr_in_middle fmt = nil assert_warn("") {fmt, = warn("\r;")} |
