ruby-changes:59867
From: Jeremy <ko1@a...>
Date: Wed, 29 Jan 2020 02:29:55 +0900 (JST)
Subject: [ruby-changes:59867] 766f8a7a60 (master): Fix some spec breakage on 2.7 related to keyword arguments
https://git.ruby-lang.org/ruby.git/commit/?id=766f8a7a60 From 766f8a7a60f32ab27c2faaa9120f47f00a5e646d Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 28 Jan 2020 09:26:02 -0800 Subject: 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. diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb index f98e856..0209ca2 100644 --- a/spec/ruby/language/method_spec.rb +++ b/spec/ruby/language/method_spec.rb @@ -1363,7 +1363,9 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L1363 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L1377 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L1420 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/