diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-01 12:09:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-01 12:09:52 -0700 |
commit | c9cd187d5aa8fa6607dd463b5f98a65483ae39ce (patch) | |
tree | b371bb72a689ef617eda4afafa8d3ca7cab4f015 /test | |
parent | a7534c26b332d8975f6d82ebe7d2e7baf8ba3b6d (diff) | |
download | psych-c9cd187d5aa8fa6607dd463b5f98a65483ae39ce.zip |
Strings tagged binary will be emitted as binary. Fixes #27
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_string.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb index 96d77e0..51f1280 100644 --- a/test/psych/test_string.rb +++ b/test/psych/test_string.rb @@ -2,6 +2,14 @@ require 'psych/helper' module Psych class TestString < TestCase + def test_tagged_binary_should_be_dumped_as_binary + string = "hello world!" + string.force_encoding 'ascii-8bit' + yml = Psych.dump string + assert_match(/binary/, yml) + assert_equal string, Psych.load(yml) + end + def test_binary_string_null string = "\x00" yml = Psych.dump string |