diff options
author | Jeremy Evans <code@jeremyevans.net> | 2020-01-28 09:26:02 -0800 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2020-01-28 09:26:02 -0800 |
commit | 766f8a7a60f32ab27c2faaa9120f47f00a5e646d (patch) | |
tree | 190e233eb056ac1f8777c573ba10741708449ed7 /spec | |
parent | fe8573f31ab4b48d0c3214dbf15ba66a192c078a (diff) | |
download | ruby-766f8a7a60f32ab27c2faaa9120f47f00a5e646d.tar.gz |
Fix some spec breakage on 2.7 related to keyword arguments
These specs were probably added in the commit to fully
separate keyword arguments after the release of 2.7.0, but
apparently not tested on 2.7 before hand. The enclosing
ruby_version guard for these specs limits them to 2.7.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/language/method_spec.rb | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb index f98e8569f8..0209ca21c9 100644 --- a/spec/ruby/language/method_spec.rb +++ b/spec/ruby/language/method_spec.rb @@ -1363,7 +1363,9 @@ describe "A method" do h = mock("keyword splat") h.should_receive(:to_hash).and_return({a: 1}) - m(h).should == {} + suppress_keyword_warning do + m(h).should == {a: 1} + end end evaluate <<-ruby do @@ -1375,28 +1377,34 @@ describe "A method" do m(a: 1).should == [nil, {a: 1}] m("a" => 1, a: 1).should == [nil, {"a" => 1, a: 1}] m({ "a" => 1 }, a: 1).should == [{"a" => 1}, {a: 1}] - ->{m({a: 1}, {})}.should raise_error(ArgumentError) + suppress_keyword_warning do + m({a: 1}, {}).should == [{a: 1}, {}] + end h = {"a" => 1, b: 2} - m(h).should == [{"a" => 1, b: 2}, {}] + suppress_keyword_warning do + m(h).should == [{"a" => 1}, {b: 2}] + end h.should == {"a" => 1, b: 2} h = {"a" => 1} m(h).first.should == h h = {} - r = m(h) - r.first.should == {} - r.last.should == {} + suppress_keyword_warning do + m(h).should == [nil, {}] + end hh = {} h = mock("keyword splat empty hash") - h.should_not_receive(:to_hash) - m(h).should == [{}, {}] + h.should_receive(:to_hash).and_return({a: 1}) + suppress_keyword_warning do + m(h).should == [nil, {a: 1}] + end h = mock("keyword splat") - h.should_not_receive(:to_hash) - m(h).should == [{"a" => 1, a: 2}, {}] + h.should_receive(:to_hash).and_return({"a" => 1}) + m(h).should == [h, {}] end evaluate <<-ruby do @@ -1412,7 +1420,9 @@ describe "A method" do m(a: 1).should == [[], {a: 1}] m("a" => 1, a: 1).should == [[], {"a" => 1, a: 1}] m({ "a" => 1 }, a: 1).should == [[{"a" => 1}], {a: 1}] - m({a: 1}, {}).should == [[{a: 1}, {}], {}] + suppress_keyword_warning do + m({a: 1}, {}).should == [[{a: 1}], {}] + end m({a: 1}, {"a" => 1}).should == [[{a: 1}, {"a" => 1}], {}] bo = BasicObject.new |