diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-11 22:52:39 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-11 22:52:39 +0000 |
commit | 3ccf45d5df944aa274ee5af054bf89b211a6ffa2 (patch) | |
tree | d8c42d9e1b2958a8f0c5abc758dbf59627f9f997 /test/ruby/test_m17n.rb | |
parent | 8130e821357852736f3e3cfed47ddab40c6b7b82 (diff) | |
download | ruby-3ccf45d5df944aa274ee5af054bf89b211a6ffa2.tar.gz ruby-3ccf45d5df944aa274ee5af054bf89b211a6ffa2.tar.xz ruby-3ccf45d5df944aa274ee5af054bf89b211a6ffa2.zip |
* encoding.c (rb_enc_compatible): If a string is empty and
other's encoding is US-ASCII, returns the empty string's encoding.
[ruby-list:46274]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r-- | test/ruby/test_m17n.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index cbab1f669..25bb0df3b 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -7,6 +7,7 @@ class TestM17N < Test::Unit::TestCase end module AESU + def ua(str) str.dup.force_encoding("US-ASCII") end def a(str) str.dup.force_encoding("ASCII-8BIT") end def e(str) str.dup.force_encoding("EUC-JP") end def s(str) str.dup.force_encoding("Windows-31J") end @@ -1300,6 +1301,7 @@ class TestM17N < Test::Unit::TestCase def test_compatible assert_nil Encoding.compatible?("",0) + assert_equal(Encoding::UTF_8, Encoding.compatible?(u(""), ua("abc"))) assert_equal(Encoding::UTF_8, Encoding.compatible?(Encoding::UTF_8, Encoding::UTF_8)) assert_equal(Encoding::UTF_8, Encoding.compatible?(Encoding::UTF_8, Encoding::US_ASCII)) assert_equal(Encoding::ASCII_8BIT, |