aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-29 10:49:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-29 10:49:40 +0000
commit12cd6efccf18d28d4ebbff75bec8c5815bbb39fd (patch)
treec5a9c1452c6a320010769aa3e80ec7b89df41791 /test/ruby
parent9974ae67b492aab2c2d4d4d67869fc40599b2553 (diff)
downloadruby-12cd6efccf18d28d4ebbff75bec8c5815bbb39fd.tar.gz
array.c: join encoding
* array.c (ary_join_1): copy the encoding of the converted string of the first element by to_str too, as an initial encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_array.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 5bd4517f2e..e7e654d181 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1085,6 +1085,7 @@ class TestArray < Test::Unit::TestCase
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)
+ assert_equal(Encoding::UTF_8, [Struct.new(:to_str).new(u)].join.encoding)
bug5379 = '[ruby-core:39776]'
assert_equal(Encoding::US_ASCII, [[], u, nil].join.encoding, bug5379)
assert_equal(Encoding::UTF_8, [[], "\u3042", nil].join.encoding, bug5379)