Skip to content

Commit

Permalink
adds spec for no keyword mark if method definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
moofkit committed Oct 10, 2020
1 parent ac60ece commit 648f40b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions language/method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,18 @@ def bo.to_hash; {:b => 2, :c => 3}; end

m(*bo, **bo).should == [[1, 2, 3], {:b => 2, :c => 3}]
end

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

evaluate <<-ruby do
Expand Down

0 comments on commit 648f40b

Please sign in to comment.