Skip to content

Commit

Permalink
Merge pull request #796 from moofkit/no_keywords_mark
Browse files Browse the repository at this point in the history
**nil no keyword mark method definitions
  • Loading branch information
andrykonchin committed Oct 11, 2020
2 parents ac60ece + 2d1db97 commit 7a5bd53
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions language/method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,20 @@ def m(a, b=1, *c, d, e:, f: 2, g:, **k, &l)
result.should == [1, 1, [], 2, 3, 2, 4, { h: 5, i: 6 }, l]
end

ruby_version_is "2.7" do
evaluate <<-ruby do
def m(a, **nil); a end;
ruby

m({a: 1}).should == {a: 1}
m({"a" => 1}).should == {"a" => 1}

-> { m(a: 1) }.should raise_error(ArgumentError)
-> { m(**{a: 1}) }.should raise_error(ArgumentError)
-> { m("a" => 1) }.should raise_error(ArgumentError)
end
end

ruby_version_is ''...'3.0' do
evaluate <<-ruby do
def m(a, b = nil, c = nil, d, e: nil, **f)
Expand Down

0 comments on commit 7a5bd53

Please sign in to comment.