summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-15 07:08:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-15 07:08:24 +0000
commitc7d3b3f1b489236e47ed9bc09666964c541c25ba (patch)
treec7a77bcd99c8f4fdc8e099d120f6f9eddd2c50d5 /test
parent7798b9667efc5396b8dd7409901c950f046c917d (diff)
* array.c (array_join): copy the encoding of the first element as
an initial encoding. * array.c (array_join_0): ditto. * array.c (array_join_1): ditto. * array.c (inspect_ary): ditto. * array.c (array_join_1): add an argument to check the appending is first one or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 1aa8c54f5c..703c417d32 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -914,6 +914,13 @@ class TestArray < Test::Unit::TestCase
s = a.join
assert_equal(true, s.tainted?)
assert_equal(true, s.untrusted?)
+
+ e = ''.force_encoding('EUC-JP')
+ u = ''.force_encoding('UTF-8')
+ assert_equal(Encoding::US_ASCII, [[]].join.encoding)
+ assert_equal(Encoding::US_ASCII, [1, [u]].join.encoding)
+ assert_equal(Encoding::UTF_8, [u, [e]].join.encoding)
+ assert_equal(Encoding::UTF_8, [u, [1]].join.encoding)
ensure
$, = nil
end