зеркало из https://github.com/github/ruby.git
spec/ruby/core/hash/constructor_spec.rb: add "ruby_version_is" guard
follow up for d3f1c615c5
This commit is contained in:
Родитель
a093c98ddc
Коммит
00f7e42451
|
@ -42,13 +42,26 @@ describe "Hash.[]" do
|
|||
Hash[ary].should == { a: :b }
|
||||
end
|
||||
|
||||
it "ignores elements that are not arrays" do
|
||||
-> {
|
||||
Hash[[:a]].should == {}
|
||||
}.should raise_error(ArgumentError)
|
||||
-> {
|
||||
Hash[[:nil]].should == {}
|
||||
}.should raise_error(ArgumentError)
|
||||
ruby_version_is "" ... "2.7" do
|
||||
it "ignores elements that are not arrays" do
|
||||
-> {
|
||||
Hash[[:a]].should == {}
|
||||
}.should complain(/ignoring wrong elements/)
|
||||
-> {
|
||||
Hash[[:nil]].should == {}
|
||||
}.should complain(/ignoring wrong elements/)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.7" do
|
||||
it "ignores elements that are not arrays" do
|
||||
-> {
|
||||
Hash[[:a]].should == {}
|
||||
}.should raise_error(ArgumentError)
|
||||
-> {
|
||||
Hash[[:nil]].should == {}
|
||||
}.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises an ArgumentError for arrays of more than 2 elements" do
|
||||
|
|
Загрузка…
Ссылка в новой задаче