mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (take_items), enum.c (enum_zip): tries to convert to
array first. [ruby-core:21442] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
13313688b2
commit
cab67c3197
5 changed files with 24 additions and 3 deletions
|
@ -211,6 +211,11 @@ class TestEnumerable < Test::Unit::TestCase
|
|||
a = []
|
||||
@obj.zip([:a, :b, :c]) {|x,y| a << [x, y] }
|
||||
assert_equal([[1,:a],[2,:b],[3,:c],[1,nil],[2,nil]], a)
|
||||
|
||||
ary = Object.new
|
||||
def ary.to_a; [1, 2]; end
|
||||
def ary.to_ary; [3, 4]; end
|
||||
assert_equal([[1, 3], [2, 4], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
|
||||
end
|
||||
|
||||
def test_take
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue