summaryrefslogtreecommitdiff
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-08 04:01:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-08 04:01:06 +0000
commit622193d32a5ca27074acd072b655e4037f845dec (patch)
treef4075af5feb61da0b1685c7a38945e28496481dd /test/ruby/test_symbol.rb
parentad470f1c3833fcd6050881e6d97a1a9cb02e3b20 (diff)
hash.c: compare symbols by identities
* hash.c (rb_any_hash): Symbols are compared by the identities always. [ruby-core:68767] [Bug #11035] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index bfdfe5245b..7f278ad4d7 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -238,4 +238,23 @@ class TestSymbol < Test::Unit::TestCase
200_000.times { |i| i.to_s.to_sym }
end;
end
+
+ def test_hash_redefinition
+ assert_separately([], <<-'end;')
+ bug11035 = '[ruby-core:68767] [Bug #11035]'
+ class Symbol
+ def hash
+ raise
+ end
+ end
+
+ h = {}
+ assert_nothing_raised(RuntimeError, bug11035) {
+ h[:foo] = 1
+ }
+ assert_nothing_raised(RuntimeError, bug11035) {
+ h['bar'.to_sym] = 2
+ }
+ end
+ end;
end