summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-06 00:09:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-06 00:09:59 +0000
commit7c3fff4f547dc8f74ffa9a0532597afeceb7bcc4 (patch)
tree91c226bd91b39d9d49cce3485f854fa221ec62e4 /test/ruby
parentdef66ceca3ec7f899ab78bb21f534a6172b4c8a1 (diff)
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_enum.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 8d22b12..6f27c5b 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -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