summaryrefslogtreecommitdiff
path: root/test/ruby/test_literal.rb
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-02-12 13:32:01 +0900
committerYuichiro Kaneko <[email protected]>2024-02-13 08:40:14 +0900
commit8a345860d3d16b3bca74caf8ee1b405287873eed (patch)
tree43222f467d6ff6864c2ae5e96cf7b14f80e1e3de /test/ruby/test_literal.rb
parentf41d8f38b44c66483388b1416a25d63be0721ee4 (diff)
Warn duplication of `__ENCODING__` on the hash
``` $ ruby -e 'h = { __ENCODING__ => 1, __ENCODING__ => 2 }' -e:1: warning: key #<Encoding:UTF-8> is duplicated and overwritten on line 1 ```
Diffstat (limited to 'test/ruby/test_literal.rb')
-rw-r--r--test/ruby/test_literal.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index a736874024..00adbff731 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -498,6 +498,7 @@ class TestRubyLiteral < Test::Unit::TestCase
'//',
'__LINE__',
'__FILE__',
+ '__ENCODING__',
) do |key|
assert_warning(/key #{Regexp.quote(eval(key).inspect)} is duplicated/) { eval("{#{key} => :bar, #{key} => :foo}") }
end