From 711f00340a68157a9e4c88aea2eb4986320bfccc Mon Sep 17 00:00:00 2001 From: Dmitriy Ivliev Date: Sun, 11 Oct 2020 10:23:03 +0300 Subject: [PATCH] move all >=2.7 specs under one guard --- language/method_spec.rb | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/language/method_spec.rb b/language/method_spec.rb index d736b4dfe..e7a5c3c39 100644 --- a/language/method_spec.rb +++ b/language/method_spec.rb @@ -972,6 +972,24 @@ def m(a=1, **) a end m("a" => 1, a: 2).should == 1 end + evaluate <<-ruby do + def m(a:, **) a end + ruby + + m(a: 1).should == 1 + m(a: 1, b: 2).should == 1 + m("a" => 1, a: 1, b: 2).should == 1 + end + + evaluate <<-ruby do + def m(a:, **k) [a, k] end + ruby + + m(a: 1).should == [1, {}] + m(a: 1, b: 2, c: 3).should == [1, {b: 2, c: 3}] + m("a" => 1, a: 1, b: 2).should == [1, {"a" => 1, b: 2}] + end + evaluate <<-ruby do def m(a, **nil); a end; ruby @@ -1524,26 +1542,6 @@ def m(a:, **k) [a, k] end end end - ruby_version_is '2.7' do - evaluate <<-ruby do - def m(a:, **) a end - ruby - - m(a: 1).should == 1 - m(a: 1, b: 2).should == 1 - m("a" => 1, a: 1, b: 2).should == 1 - end - - evaluate <<-ruby do - def m(a:, **k) [a, k] end - ruby - - m(a: 1).should == [1, {}] - m(a: 1, b: 2, c: 3).should == [1, {b: 2, c: 3}] - m("a" => 1, a: 1, b: 2).should == [1, {"a" => 1, b: 2}] - end - end - evaluate <<-ruby do def m(a:, &b) [a, b] end ruby