diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-05-23 00:15:55 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-05-23 00:19:56 +0900 |
commit | d3f1c615c5b81319e422e9c92e1cb8ba82209fba (patch) | |
tree | 66cf55c8efbc4c606d50d186b6d5f990ff928a88 /spec/ruby/core | |
parent | 4d62296948c36615e73b99d592253256d0ea0d4a (diff) | |
download | ruby-d3f1c615c5b81319e422e9c92e1cb8ba82209fba.tar.gz |
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/ruby/core')
-rw-r--r-- | spec/ruby/core/hash/constructor_spec.rb | 4 |
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 |