1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2022-08-29 15:36:29 +02:00
parent a319d3cfdc
commit 4ee1a68776
32 changed files with 471 additions and 50 deletions

View file

@ -58,6 +58,24 @@ ruby_version_is "3.0" do
m(kw: 1).should == []
-> { m(kw: 1, kw2: 2) }.should raise_error(ArgumentError, 'unknown keyword: :kw2')
-> { m(kw: 1, true => false) }.should raise_error(ArgumentError, 'unknown keyword: true')
-> { m(kw: 1, a: 1, b: 2, c: 3) }.should raise_error(ArgumentError, 'unknown keywords: :a, :b, :c')
end
it "raises ArgumentError exception when required keyword argument is not passed" do
def m(a:, b:, c:)
[a, b, c]
end
-> { m(a: 1, b: 2) }.should raise_error(ArgumentError, /missing keyword: :c/)
-> { m() }.should raise_error(ArgumentError, /missing keywords: :a, :b, :c/)
end
it "raises ArgumentError for missing keyword arguments even if there are extra ones" do
def m(a:)
a
end
-> { m(b: 1) }.should raise_error(ArgumentError, /missing keyword: :a/)
end
it "handle * and ** at the same call site" do