summaryrefslogtreecommitdiff
path: root/test/ruby/test_hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r--test/ruby/test_hash.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index dd93a63340..4431552dd9 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1269,6 +1269,17 @@ class TestHash < Test::Unit::TestCase
assert_equal(bug9381, hash[wrapper.new(5)])
end
+ def test_label_syntax
+ return unless @cls == Hash
+
+ feature4935 = '[ruby-core:37553] [Feature #4935]'
+ x = 'world'
+ hash = assert_nothing_raised(SyntaxError) do
+ break eval(%q({foo: 1, "foo-bar": 2, "hello-#{x}": 3, 'hello-#{x}': 4}))
+ end
+ assert_equal({:foo => 1, :'foo-bar' => 2, :'hello-world' => 3, :'hello-#{x}' => 4}, hash)
+ end
+
class TestSubHash < TestHash
class SubHash < Hash
def reject(*)