summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-07 04:34:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-07 04:34:34 +0000
commite895bc3cdb71eb950951f6a7b7ce70bcb2ae9022 (patch)
tree3c57971c07372421166c18c035036508e0a35bc5 /test/ruby
parent9041ac4289cc88751d4d7d492f0402c13fac3057 (diff)
* enum.c (rb_enum_join): non-nil separator must be convertible to
String. [ruby-core:24172] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_enum.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 6f27c5b..e0e77b4 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -285,8 +285,15 @@ class TestEnumerable < Test::Unit::TestCase
end
def test_join
+ ofs = $,
assert_equal("abc", ("a".."c").join(""))
assert_equal("a-b-c", ("a".."c").join("-"))
+ $, = "-"
+ assert_equal("a-b-c", ("a".."c").join())
+ $, = nil
+ assert_equal("abc", ("a".."c").join())
+ assert_equal("123", (1..3).join())
+ assert_raise(TypeError, '[ruby-core:24172]') {("a".."c").join(1)}
class << (e = Object.new.extend(Enumerable))
def to_s
"e"
@@ -296,5 +303,7 @@ class TestEnumerable < Test::Unit::TestCase
end
end
assert_equal("e", e.join(""))
+ ensure
+ $, = ofs
end
end