summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-05-23 00:15:55 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-05-23 00:19:56 +0900
commitd3f1c615c5b81319e422e9c92e1cb8ba82209fba (patch)
tree66cf55c8efbc4c606d50d186b6d5f990ff928a88 /spec
parent4d62296948c36615e73b99d592253256d0ea0d4a (diff)
hash.c (rb_hash_s_create): Reject `Hash[[nil]]`
The behavior of `Hash[[nil]] #=> {}` was a bug until 1.9.3, but had been remained with a warning because some programs depended upon it. Now, six years passed. We can remove the compatibility behavior. [Bug #7300]
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/hash/constructor_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/hash/constructor_spec.rb b/spec/ruby/core/hash/constructor_spec.rb
index 55681c2a7c..4e02a955bd 100644
--- a/spec/ruby/core/hash/constructor_spec.rb
+++ b/spec/ruby/core/hash/constructor_spec.rb
@@ -45,10 +45,10 @@ describe "Hash.[]" do
it "ignores elements that are not arrays" do
-> {
Hash[[:a]].should == {}
- }.should complain(/ignoring wrong elements/)
+ }.should raise_error(ArgumentError)
-> {
Hash[[:nil]].should == {}
- }.should complain(/ignoring wrong elements/)
+ }.should raise_error(ArgumentError)
end
it "raises an ArgumentError for arrays of more than 2 elements" do