summaryrefslogtreecommitdiff
path: root/spec/ruby/core/hash/shared/store.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/hash/shared/store.rb')
-rw-r--r--spec/ruby/core/hash/shared/store.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/core/hash/shared/store.rb b/spec/ruby/core/hash/shared/store.rb
index 84ffb41e33..eca0e5a8e8 100644
--- a/spec/ruby/core/hash/shared/store.rb
+++ b/spec/ruby/core/hash/shared/store.rb
@@ -95,4 +95,21 @@ describe :hash_store, shared: true do
hash.each { hash.send(@method, 1, :foo) }
hash.should == {1 => :foo, 3 => 4, 5 => 6}
end
+
+ it "does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" do
+ code = <<-EOC
+ load '#{fixture __FILE__, "name.rb"}'
+ hash = {}
+ [true, false, 1, 2.0, "hello", :ok].each do |value|
+ hash[value] = 42
+ raise "incorrect value" unless hash[value] == 42
+ hash[value] = 43
+ raise "incorrect value" unless hash[value] == 43
+ end
+ puts "OK"
+ puts hash.size
+ EOC
+ result = ruby_exe(code, args: "2>&1")
+ result.should == "OK\n6\n"
+ end
end