summaryrefslogtreecommitdiff
path: root/spec/ruby/language/method_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/method_spec.rb')
-rw-r--r--spec/ruby/language/method_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index 96abbc649d4..54f0c6ccf8c 100644
--- a/spec/ruby/language/method_spec.rb
+++ b/spec/ruby/language/method_spec.rb
@@ -512,6 +512,15 @@ describe "A method" do
end
evaluate <<-ruby do
+ def m() end
+ ruby
+
+ m().should be_nil
+ m(*[]).should be_nil
+ m(**{}).should be_nil
+ end
+
+ evaluate <<-ruby do
def m(*) end
ruby
@@ -527,6 +536,8 @@ describe "A method" do
m().should == []
m(1).should == [1]
m(1, 2, 3).should == [1, 2, 3]
+ m(*[]).should == []
+ m(**{}).should == []
end
evaluate <<-ruby do
@@ -561,6 +572,8 @@ describe "A method" do
m().should == {}
m(a: 1, b: 2).should == { a: 1, b: 2 }
+ m(*[]).should == {}
+ m(**{}).should == {}
lambda { m(2) }.should raise_error(ArgumentError)
end