1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_enumerator.rb: fix last commit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-08-20 19:09:03 +00:00
parent 2d3724e058
commit 3fffbe1e82
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Tue Aug 21 04:08:07 2007 Koichi Sasada <ko1@atdot.net>
* test/ruby/test_enumerator.rb: fix last commit.
Tue Aug 21 03:59:32 2007 Koichi Sasada <ko1@atdot.net>
* test_enumerator.rb (enum_test): fix to return sorted

View file

@ -4,14 +4,14 @@ class TestEnumerator < Test::Unit::TestCase
def enum_test obj
i = 0
obj.map{|e|
[i+=1, e]
e
}.sort
end
def test_iterators
assert_equal [[1, 0], [2, 1], [3, 2]], enum_test(3.times)
assert_equal [[1, :x], [2, :y], [3, :z]], enum_test([:x, :y, :z].each)
assert_equal [[1, [:x, 1]], [2, [:y, 2]]], enum_test({:x=>1, :y=>2})
assert_equal [0, 1, 2], enum_test(3.times)
assert_equal [:x, :y, :z], enum_test([:x, :y, :z].each)
assert_equal [[:x, 1], [:y, 2]], enum_test({:x=>1, :y=>2})
end
## Enumerator as Iterator