From 2d1db97b53580834090dcbc5e3b33e37c41a85da Mon Sep 17 00:00:00 2001 From: Dmitriy Ivliev Date: Sat, 10 Oct 2020 17:40:02 +0300 Subject: [PATCH] adds spec for no keyword mark if method definitions --- language/method_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/language/method_spec.rb b/language/method_spec.rb index dd4ea51572..5a0641452d 100644 --- a/language/method_spec.rb +++ b/language/method_spec.rb @@ -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)