diff options
Diffstat (limited to 'spec/ruby/core/kernel/lambda_spec.rb')
-rw-r--r-- | spec/ruby/core/kernel/lambda_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb index 4796d65352..537ac2628c 100644 --- a/spec/ruby/core/kernel/lambda_spec.rb +++ b/spec/ruby/core/kernel/lambda_spec.rb @@ -31,13 +31,28 @@ describe "Kernel.lambda" do l.lambda?.should be_true end - it "returned the passed Proc if given an existing Proc" do + it "returns the passed Proc if given an existing Proc" do some_proc = proc {} l = lambda(&some_proc) l.should equal(some_proc) l.lambda?.should be_false end + it "creates a lambda-style Proc when called with zsuper" do + l = KernelSpecs::LambdaSpecs::ForwardBlockWithZSuper.new.lambda { 42 } + l.lambda?.should be_true + l.call.should == 42 + + lambda { l.call(:extra) }.should raise_error(ArgumentError) + end + + it "returns the passed Proc if given an existing Proc through super" do + some_proc = proc { } + l = KernelSpecs::LambdaSpecs::SuperAmpersand.new.lambda(&some_proc) + l.should equal(some_proc) + l.lambda?.should be_false + end + it "checks the arity of the call when no args are specified" do l = lambda { :called } l.call.should == :called |