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
|
@ -186,9 +186,19 @@ describe "A lambda literal -> () { }" do
|
|||
@a.().should == {}
|
||||
@a.(1, 2, 3, a: 4, b: 5).should == {a: 4, b: 5}
|
||||
|
||||
h = mock("keyword splat")
|
||||
h.should_receive(:to_hash).and_return({a: 1})
|
||||
@a.(h).should == {a: 1}
|
||||
def self.suppress_keyword_warning(&block)
|
||||
if RUBY_VERSION > '2.7'
|
||||
suppress_warning(&block)
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
suppress_keyword_warning do
|
||||
h = mock("keyword splat")
|
||||
h.should_receive(:to_hash).and_return({a: 1})
|
||||
@a.(h).should == {a: 1}
|
||||
end
|
||||
end
|
||||
|
||||
evaluate <<-ruby do
|
||||
|
@ -520,9 +530,19 @@ describe "A lambda expression 'lambda { ... }'" do
|
|||
@a.().should == {}
|
||||
@a.(1, 2, 3, a: 4, b: 5).should == {a: 4, b: 5}
|
||||
|
||||
h = mock("keyword splat")
|
||||
h.should_receive(:to_hash).and_return({a: 1})
|
||||
@a.(h).should == {a: 1}
|
||||
def self.suppress_keyword_warning(&block)
|
||||
if RUBY_VERSION > '2.7'
|
||||
suppress_warning(&block)
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
suppress_keyword_warning do
|
||||
h = mock("keyword splat")
|
||||
h.should_receive(:to_hash).and_return({a: 1})
|
||||
@a.(h).should == {a: 1}
|
||||
end
|
||||
end
|
||||
|
||||
evaluate <<-ruby do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue