Skip to content

Commit

Permalink
Update Enumerable#inject to raise a LocalJumpError if no block or sym…
Browse files Browse the repository at this point in the history
…bol are given
  • Loading branch information
bjfish authored and eregon committed Mar 28, 2022
1 parent 162981d commit 570fb2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/enumerable/shared/inject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@
it "returns nil when fails(legacy rubycon)" do
EnumerableSpecs::EachDefiner.new().send(@method) {|acc,x| 999 }.should == nil
end
ruby_bug '#18635', ''...'3.2' do
it "raises an ArgumentError when no parameters or block is given" do
-> { [1,2].send(@method) }.should raise_error(ArgumentError)
-> { {one: 1, two: 2}.send(@method) }.should raise_error(ArgumentError)
end
end
end

0 comments on commit 570fb2d

Please sign in to comment.