Skip to content

Commit

Permalink
move all >=2.7 specs under one guard
Browse files Browse the repository at this point in the history
  • Loading branch information
moofkit committed Oct 11, 2020
1 parent 5d3cf55 commit 711f003
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions language/method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 711f003

Please sign in to comment.