diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-03 05:13:54 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-03 05:13:54 +0000 |
commit | 742d440cba11e4c4a72f6b8d1bbaadc207553243 (patch) | |
tree | d4ecb2bb4d6f57d070b940c5c7793aa505691053 /test/ruby/test_m17n.rb | |
parent | f6b2490fdb7d30d0c4ab37d63801f969c1aad4d5 (diff) |
* 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/trunk@29676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r-- | test/ruby/test_m17n.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 2eace6acbf..53abfccb82 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1299,6 +1299,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 |