diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-16 03:07:52 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-16 03:07:52 +0000 |
commit | c1dc27f7c2e0902457a74017ca76b439ab20e269 (patch) | |
tree | 74fda92eeeafef5d074a24f0f1407b398543abe3 /test/psych | |
parent | 675fde2e7b57d76aab612947f6cfddc4bd0514aa (diff) |
merges r27723 from trunk into ruby_1_9_2.
--
* ext/psych/parser.c (parse): Return strings encoded as
Encoding.default_internal if set.
* test/psych/test_encoding.rb: Tests for encoding change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-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 |