aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/language/method_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 20:38:57 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 20:38:57 +0000
commit50441014ffd3645f258e56b9415b7787c910408b (patch)
tree3d5eef5ad1ea7e389dc51fc87437664b984ac184 /spec/ruby/language/method_spec.rb
parent49cd16bfaf4f03885058ce748119bc8ea2de735a (diff)
downloadruby-50441014ffd3645f258e56b9415b7787c910408b.tar.gz
Update to ruby/spec@cdd6ff7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/language/method_spec.rb')
-rw-r--r--spec/ruby/language/method_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index 54f0c6ccf8..c5612ed19f 100644
--- a/spec/ruby/language/method_spec.rb
+++ b/spec/ruby/language/method_spec.rb
@@ -1269,7 +1269,7 @@ describe "A method" do
def m(a, b = nil, c = nil, d, e: nil, **f)
[a, b, c, d, e, f]
end
- ruby
+ ruby
result = m(1, 2)
result.should == [1, nil, nil, 2, nil, {}]
@@ -1281,6 +1281,19 @@ describe "A method" do
result.should == [1, nil, nil, {foo: :bar}, nil, {}]
end
end
+
+ context "assigns keyword arguments from a passed Hash without modifying it" do
+ evaluate <<-ruby do
+ def m(a: nil); a; end
+ ruby
+
+ options = {a: 1}.freeze
+ lambda do
+ m(options).should == 1
+ end.should_not raise_error
+ options.should == {a: 1}
+ end
+ end
end
describe "A method call with a space between method name and parentheses" do