diff options
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/test_parser.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb index 9ef2a41e1d..8c4483309b 100644 --- a/test/psych/test_parser.rb +++ b/test/psych/test_parser.rb @@ -1,3 +1,5 @@ +# coding: utf-8 + require_relative 'helper' module Psych @@ -24,6 +26,23 @@ module Psych @parser = Psych::Parser.new EventCatcher.new end + def test_bom + tadpole = 'おたまじゃくし' + + # BOM + text + yml = "\uFEFF#{tadpole}".encode('UTF-16LE') + @parser.parse yml + assert_equal tadpole, @parser.handler.calls[2][1].first + end + + def test_external_encoding + tadpole = 'おたまじゃくし' + + @parser.external_encoding = Psych::Parser::UTF16LE + @parser.parse tadpole.encode 'UTF-16LE' + assert_equal tadpole, @parser.handler.calls[2][1].first + end + def test_bogus_io o = Object.new def o.read len; self end |