mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update specs to handle non-Symbols for keyword splats in 2.7
Also handle some warnings for behavior that will change in 3.0.
This commit is contained in:
parent
16cd0de6ec
commit
a810f6cbef
Notes:
git
2019-08-31 04:40:14 +09:00
5 changed files with 362 additions and 134 deletions
|
@ -128,9 +128,18 @@ describe "Hash literal" do
|
|||
{a: 1, **obj, c: 3}.should == {a:1, b: 2, c: 3, d: 4}
|
||||
end
|
||||
|
||||
it "raises a TypeError if any splatted elements keys are not symbols" do
|
||||
h = {1 => 2, b: 3}
|
||||
-> { {a: 1, **h} }.should raise_error(TypeError)
|
||||
ruby_version_is "0"..."2.7" do
|
||||
it "raises a TypeError if any splatted elements keys are not symbols" do
|
||||
h = {1 => 2, b: 3}
|
||||
-> { {a: 1, **h} }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.7" do
|
||||
it "allows splatted elements keys that are not symbols" do
|
||||
h = {1 => 2, b: 3}
|
||||
{a: 1, **h}.should == {a: 1, 1 => 2, b: 3}
|
||||
end
|
||||
end
|
||||
|
||||
it "raises a TypeError if #to_hash does not return a Hash" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue