summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-08 08:09:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-08 08:09:14 +0000
commit40236a58c6c9c10e9041a889eb843ee581c6b156 (patch)
tree5194a2d3fcace4493fae2646bed010b831ee3e26 /test
parent2f7d3b465325021f24460fefe3505b374653a018 (diff)
merges r29676 from trunk into ruby_1_9_2.
-- * string.c (rb_enc_cr_str_buf_cat): concatenation of valid encoding string and invalid encoding string should result invalid encoding. [ruby-core:33027] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 9f1419df7d..3682d09898 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1294,6 +1294,16 @@ class TestM17N < Test::Unit::TestCase
s = "\xa1\xa1\x8f".force_encoding("euc-jp")
assert_equal(false, s.valid_encoding?)
assert_equal(true, s.reverse.valid_encoding?)
+
+ bug4018 = '[ruby-core:33027]'
+ s = "\xa1\xa1".force_encoding("euc-jp")
+ assert_equal(true, s.valid_encoding?)
+ s << "\x8f".force_encoding("euc-jp")
+ assert_equal(false, s.valid_encoding?, bug4018)
+ s = "aa".force_encoding("utf-16be")
+ assert_equal(true, s.valid_encoding?)
+ s << "\xff".force_encoding("utf-16be")
+ assert_equal(false, s.valid_encoding?, bug4018)
end
def test_getbyte