From 45cf4f218728a15eb36d14a6c9912086525f5e3f Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 25 Apr 2022 14:53:54 +0200 Subject: Update to ruby/spec@3affe1e --- spec/ruby/language/return_spec.rb | 46 ++++++++++++++------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'spec/ruby/language/return_spec.rb') diff --git a/spec/ruby/language/return_spec.rb b/spec/ruby/language/return_spec.rb index d8506834c8..94c15b697e 100644 --- a/spec/ruby/language/return_spec.rb +++ b/spec/ruby/language/return_spec.rb @@ -422,18 +422,16 @@ describe "The return keyword" do end describe "within a block within a class" do - ruby_version_is "2.7" do - it "is not allowed" do - File.write(@filename, <<-END_OF_CODE) - class ReturnSpecs::A - ScratchPad << "before return" - 1.times { return } - ScratchPad << "after return" - end - END_OF_CODE - - -> { load @filename }.should raise_error(LocalJumpError) - end + it "is not allowed" do + File.write(@filename, <<-END_OF_CODE) + class ReturnSpecs::A + ScratchPad << "before return" + 1.times { return } + ScratchPad << "after return" + end + END_OF_CODE + + -> { load @filename }.should raise_error(LocalJumpError) end end @@ -464,25 +462,13 @@ describe "The return keyword" do end describe "return with argument" do - ruby_version_is ""..."2.7" do - it "does not affect exit status" do - ruby_exe(<<-END_OF_CODE).should == "" - return 10 - END_OF_CODE - - $?.exitstatus.should == 0 - end - end - - ruby_version_is "2.7" do - it "warns but does not affect exit status" do - err = ruby_exe(<<-END_OF_CODE, args: "2>&1") - return 10 - END_OF_CODE - $?.exitstatus.should == 0 + it "warns but does not affect exit status" do + err = ruby_exe(<<-END_OF_CODE, args: "2>&1") + return 10 + END_OF_CODE + $?.exitstatus.should == 0 - err.should =~ /warning: argument of top-level return is ignored/ - end + err.should =~ /warning: argument of top-level return is ignored/ end end end -- cgit v1.2.3