diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2019-07-15 00:35:30 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2019-12-21 09:08:52 -0500 |
commit | ddb6023d64a8c96348b4e67603753e2916a04f28 (patch) | |
tree | 636ec4e4ef2e6f63b60d108f4abf8ad817aed229 /spec/ruby | |
parent | e0b336c8ce84e1456fc6126ca232289667db3e19 (diff) |
Add spec for capturing Kernel#lambda with Kernel#method
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2289
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/core/kernel/lambda_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb index 537ac2628c..5c30511270 100644 --- a/spec/ruby/core/kernel/lambda_spec.rb +++ b/spec/ruby/core/kernel/lambda_spec.rb @@ -53,6 +53,13 @@ describe "Kernel.lambda" do l.lambda?.should be_false end + it "does not create lambda-style Procs when captured with #method" do + kernel_lambda = method(:lambda) + l = kernel_lambda.call { 42 } + l.lambda?.should be_false + l.call(:extra).should == 42 + end + it "checks the arity of the call when no args are specified" do l = lambda { :called } l.call.should == :called |