diff options
Diffstat (limited to 'spec/ruby/language/send_spec.rb')
-rw-r--r-- | spec/ruby/language/send_spec.rb | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/spec/ruby/language/send_spec.rb b/spec/ruby/language/send_spec.rb index 5999079d58..aaccdf0998 100644 --- a/spec/ruby/language/send_spec.rb +++ b/spec/ruby/language/send_spec.rb @@ -43,7 +43,7 @@ describe "Invoking a method" do end describe "with optional arguments" do - it "uses the optional argument if none is is passed" do + it "uses the optional argument if none is passed" do specs.fooM0O1.should == [1] end @@ -411,36 +411,18 @@ describe "Invoking a method" do specs.rest_len(0,*a,4,*5,6,7,*c,-1).should == 11 end - ruby_version_is ""..."3.0" do - it "expands the Array elements from the splat after executing the arguments and block if no other arguments follow the splat" do - def self.m(*args, &block) - [args, block] - end - - args = [1, nil] - m(*args, &args.pop).should == [[1], nil] - - args = [1, nil] - order = [] - m(*(order << :args; args), &(order << :block; args.pop)).should == [[1], nil] - order.should == [:args, :block] + it "expands the Array elements from the splat before applying block argument operations" do + def self.m(*args, &block) + [args, block] end - end - ruby_version_is "3.0" do - it "expands the Array elements from the splat before applying block argument operations" do - def self.m(*args, &block) - [args, block] - end - - args = [1, nil] - m(*args, &args.pop).should == [[1, nil], nil] + args = [1, nil] + m(*args, &args.pop).should == [[1, nil], nil] - args = [1, nil] - order = [] - m(*(order << :args; args), &(order << :block; args.pop)).should == [[1, nil], nil] - order.should == [:args, :block] - end + args = [1, nil] + order = [] + m(*(order << :args; args), &(order << :block; args.pop)).should == [[1, nil], nil] + order.should == [:args, :block] end it "evaluates the splatted arguments before the block if there are other arguments after the splat" do |