diff options
Diffstat (limited to 'spec/ruby/language/proc_spec.rb')
-rw-r--r-- | spec/ruby/language/proc_spec.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/spec/ruby/language/proc_spec.rb b/spec/ruby/language/proc_spec.rb index f8a29962b0..cc69b7799c 100644 --- a/spec/ruby/language/proc_spec.rb +++ b/spec/ruby/language/proc_spec.rb @@ -161,6 +161,18 @@ describe "A Proc" do end end + describe "taking |*a, b| arguments" do + it "assigns [] to the argument when passed no values" do + proc { |*a, b| [a, b] }.call.should == [[], nil] + end + end + + describe "taking |a, *b, c| arguments" do + it "assigns [] to the argument when passed no values" do + proc { |a, *b, c| [a, b, c] }.call.should == [nil, [], nil] + end + end + describe "taking |a, | arguments" do before :each do @l = lambda { |a, | a } @@ -223,18 +235,8 @@ describe "A Proc" do @p = proc { |*a, **kw| [a, kw] } end - ruby_version_is ""..."3.0" do - it 'autosplats keyword arguments and warns' do - -> { - @p.call([1, {a: 1}]).should == [[1], {a: 1}] - }.should complain(/warning: Using the last argument as keyword parameters is deprecated; maybe \*\* should be added to the call/) - end - end - - ruby_version_is "3.0" do - it 'does not autosplat keyword arguments' do - @p.call([1, {a: 1}]).should == [[[1, {a: 1}]], {}] - end + it 'does not autosplat keyword arguments' do + @p.call([1, {a: 1}]).should == [[[1, {a: 1}]], {}] end end |