-
-
Notifications
You must be signed in to change notification settings - Fork 921
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from isaiah/master
Resolve #482 Array#zip with infinite enum results in OOM
- Loading branch information
Showing
3 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
require 'rspec' | |||
|
|||
describe "zip an array with" do | |||
it "infinite enum returns a correct new array" do | |||
[1,2].zip([0].cycle).should == [[1,0], [2,0]] | |||
end | |||
|
|||
it "infinite enum, appending block is yielded with correct argument" do | |||
arr = [] | |||
[1,2].zip([0].cycle){|a| arr << a} | |||
arr.should == [[1,0], [2,0]] | |||
end | |||
|
|||
it "another array returns a correct new array" do | |||
[1,2].zip([0]).should == [[1,0], [2,nil]] | |||
end | |||
|
|||
it "another array, appending block is yielded with correct argument" do | |||
arr = [] | |||
[1,2].zip([0]){|a| arr << a} | |||
arr.should == [[1,0], [2,nil]] | |||
end | |||
end | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters