From 9f1fb0a17febc59356d58cef5e98db61a3c03550 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 10 Jan 2019 08:19:14 +0000 Subject: proc.c: proc without block * proc.c (proc_new): promoted lambda/proc/Proc.new with no block in a method called with a block to a warning/error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/language/lambda_spec.rb | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'spec/ruby/language') diff --git a/spec/ruby/language/lambda_spec.rb b/spec/ruby/language/lambda_spec.rb index 3934a2bd91..7114a38e5c 100644 --- a/spec/ruby/language/lambda_spec.rb +++ b/spec/ruby/language/lambda_spec.rb @@ -310,14 +310,25 @@ describe "A lambda expression 'lambda { ... }'" do def meth; lambda; end end - it "can be created" do - implicit_lambda = nil - -> { - implicit_lambda = meth { 1 } - }.should complain(/tried to create Proc object without a block/) - - implicit_lambda.lambda?.should be_true - implicit_lambda.call.should == 1 + ruby_version_is ""..."2.7" do + it "can be created" do + implicit_lambda = nil + -> { + implicit_lambda = meth { 1 } + }.should complain(/tried to create Proc object without a block/) + + implicit_lambda.lambda?.should be_true + implicit_lambda.call.should == 1 + end + end + + ruby_version_is "2.7" do + it "raises ArgumentError" do + implicit_lambda = nil + -> { + meth { 1 } + }.should raise_error(ArgumentError, /tried to create Proc object without a block/) + end end end -- cgit v1.2.3