diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-30 09:34:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-30 09:34:19 +0000 |
commit | 5db5677c6662bf56b06a06b132d946c6265fae15 (patch) | |
tree | f26844a5b31cb72ff746a831041f3e864ee4b430 /test/ruby/test_transcode.rb | |
parent | 8e0013ea45fe5ba0b98274bc07d9afe1139b8420 (diff) |
encoding.c: mask dummy flags
* encoding.c (must_encindex, rb_enc_from_index, rb_obj_encoding): mask
encoding index and ignore dummy flags. [ruby-core:59354] [Bug #9314]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_transcode.rb')
-rw-r--r-- | test/ruby/test_transcode.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 25c9d24663..74190daba7 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -2080,4 +2080,15 @@ class TestTranscode < Test::Unit::TestCase assert_equal "\ufffd", str.encode(invalid: :replace), bug8995 end end + + def test_valid_dummy_encoding + bug9314 = '[ruby-core:59354] [Bug #9314]' + assert_separately(%W[- -- #{bug9314}], <<-'end;') + bug = ARGV.shift + result = assert_nothing_raised(TypeError) {break "test".encode(Encoding::UTF_16)} + assert_equal("\xFE\xFF\x00t\x00e\x00s\x00t", result.b) + result = assert_nothing_raised(TypeError) {break "test".encode(Encoding::UTF_32)} + assert_equal("\x00\x00\xFE\xFF\x00\x00\x00t\x00\x00\x00e\x00\x00\x00s\x00\x00\x00t", result.b) + end; + end end |