diff options
Diffstat (limited to 'test/psych/test_encoding.rb')
-rw-r--r-- | test/psych/test_encoding.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb index 9d290f1c0a..bf8318a774 100644 --- a/test/psych/test_encoding.rb +++ b/test/psych/test_encoding.rb @@ -29,6 +29,22 @@ module Psych @utf8 = Encoding.find('UTF-8') end + def test_default_internal + before = Encoding.default_internal + + Encoding.default_internal = 'EUC-JP' + + str = "壁に耳あり、障子に目あり" + yaml = "--- #{str}" + assert_equal @utf8, str.encoding + + @parser.parse str + assert_encodings Encoding.find('EUC-JP'), @handler.strings + assert_equal str, @handler.strings.first.encode('UTF-8') + ensure + Encoding.default_internal = before + end + def test_scalar @parser.parse("--- a") assert_encodings @utf8, @handler.strings |