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

* enum.c (enum_join): deals with self recursive objects to get rid

of infinite recursion.  [ruby-core:24150]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-07-06 00:09:59 +00:00
parent def66ceca3
commit 7c3fff4f54

View file

@ -283,4 +283,18 @@ class TestEnumerable < Test::Unit::TestCase
def test_reverse_each
assert_equal([2,1,3,2,1], @obj.reverse_each.to_a)
end
def test_join
assert_equal("abc", ("a".."c").join(""))
assert_equal("a-b-c", ("a".."c").join("-"))
class << (e = Object.new.extend(Enumerable))
def to_s
"e"
end
def each
yield self
end
end
assert_equal("e", e.join(""))
end
end