aboutsummaryrefslogtreecommitdiffstats
path: root/test/psych/test_string.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-01 19:07:44 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-01 19:07:44 +0000
commit8659de2e0f2ee5401d0486d7efaeb7c831564ac1 (patch)
treebd27fbb320a91989eacdd9dcd1e0d9cc354d0621 /test/psych/test_string.rb
parent6e6feaf8da3a0d1f3179aba199221aa375ee9269 (diff)
downloadruby-8659de2e0f2ee5401d0486d7efaeb7c831564ac1.tar.gz
* ext/psych/lib/psych/visitors/yaml_tree.rb: emit strings tagged as
ascii-8bit as binary in YAML. * test/psych/test_string.rb: corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_string.rb')
-rw-r--r--test/psych/test_string.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index 96d77e0f42..51f1280abf 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