diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-10-24 15:52:37 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-10-24 15:53:53 +0200 |
commit | 148961adcd0704d964fce920330a6301b9704c25 (patch) | |
tree | 1f1f0cb7326775788683c77f0e2cceb495d3cc95 /spec/ruby/core/hash/element_reference_spec.rb | |
parent | 342fbae83c2e80d1b49656bc7c689cc7fe8980ce (diff) |
Update to ruby/spec@4f59d86
Diffstat (limited to 'spec/ruby/core/hash/element_reference_spec.rb')
-rw-r--r-- | spec/ruby/core/hash/element_reference_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/hash/element_reference_spec.rb b/spec/ruby/core/hash/element_reference_spec.rb index 2eb65d3789..e271f37ea6 100644 --- a/spec/ruby/core/hash/element_reference_spec.rb +++ b/spec/ruby/core/hash/element_reference_spec.rb @@ -117,4 +117,18 @@ describe "Hash#[]" do key = HashSpecs::KeyWithPrivateHash.new { key => 42 }[key].should == 42 end + + it "does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" do + code = <<-EOC + load '#{fixture __FILE__, "name.rb"}' + hash = { true => 42, false => 42, 1 => 42, 2.0 => 42, "hello" => 42, :ok => 42 } + [true, false, 1, 2.0, "hello", :ok].each do |value| + raise "incorrect value" unless hash[value] == 42 + end + puts "Ok." + EOC + result = ruby_exe(code, args: "2>&1") + result.should == "Ok.\n" + end + end |