summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/block_spec.rb2
-rw-r--r--spec/ruby/language/method_spec.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/spec/ruby/language/block_spec.rb b/spec/ruby/language/block_spec.rb
index f674c1d0e4..e35b0ed767 100644
--- a/spec/ruby/language/block_spec.rb
+++ b/spec/ruby/language/block_spec.rb
@@ -57,7 +57,7 @@ describe "A block yielded a single" do
result.should == [{"a" => 1, "b" => 2}, {}]
end
- describe("when non-symbol keys are in a keyword arguments Hash") do
+ describe "when non-symbol keys are in a keyword arguments Hash" do
ruby_version_is ""..."2.6" do
it "separates non-symbol keys and symbol keys" do
result = m(["a" => 10, b: 2]) { |a=nil, **b| [a, b] }
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index 96abbc649d..54f0c6ccf8 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