1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should

be able to take an emitter object as it's output.

* test/psych/visitors/test_yaml_tree.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2012-10-28 01:06:09 +00:00
parent f3e5f2cd75
commit dbe6250af2
3 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Sun Oct 28 10:05:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should
be able to take an emitter object as it's output.
* test/psych/visitors/test_yaml_tree.rb: related test.
Sun Oct 28 08:23:16 2012 Koichi Sasada <ko1@atdot.net> Sun Oct 28 08:23:16 2012 Koichi Sasada <ko1@atdot.net>
* bignum.c (bignew_1): Bignum instances are frozen. * bignum.c (bignew_1): Bignum instances are frozen.

View file

@ -65,7 +65,7 @@ module Psych
@emitter.start_document version, [], false @emitter.start_document version, [], false
accept object accept object
@emitter.end_document @emitter.end_document !@emitter.streaming?
end end
alias :<< :push alias :<< :push

View file

@ -8,6 +8,17 @@ module Psych
@v = Visitors::YAMLTree.new @v = Visitors::YAMLTree.new
end end
def test_yaml_tree_can_take_an_emitter
io = StringIO.new
e = Psych::Emitter.new io
v = Visitors::YAMLTree.new({}, e)
v.start
v << "hello world"
v.finish
assert_match "hello world", io.string
end
def test_binary_formatting def test_binary_formatting
gif = "GIF89a\f\x00\f\x00\x84\x00\x00\xFF\xFF\xF7\xF5\xF5\xEE\xE9\xE9\xE5fff\x00\x00\x00\xE7\xE7\xE7^^^\xF3\xF3\xED\x8E\x8E\x8E\xE0\xE0\xE0\x9F\x9F\x9F\x93\x93\x93\xA7\xA7\xA7\x9E\x9E\x9Eiiiccc\xA3\xA3\xA3\x84\x84\x84\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9!\xFE\x0EMade with GIMP\x00,\x00\x00\x00\x00\f\x00\f\x00\x00\x05, \x8E\x810\x9E\xE3@\x14\xE8i\x10\xC4\xD1\x8A\b\x1C\xCF\x80M$z\xEF\xFF0\x85p\xB8\xB01f\r\e\xCE\x01\xC3\x01\x1E\x10' \x82\n\x01\x00;" gif = "GIF89a\f\x00\f\x00\x84\x00\x00\xFF\xFF\xF7\xF5\xF5\xEE\xE9\xE9\xE5fff\x00\x00\x00\xE7\xE7\xE7^^^\xF3\xF3\xED\x8E\x8E\x8E\xE0\xE0\xE0\x9F\x9F\x9F\x93\x93\x93\xA7\xA7\xA7\x9E\x9E\x9Eiiiccc\xA3\xA3\xA3\x84\x84\x84\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9!\xFE\x0EMade with GIMP\x00,\x00\x00\x00\x00\f\x00\f\x00\x00\x05, \x8E\x810\x9E\xE3@\x14\xE8i\x10\xC4\xD1\x8A\b\x1C\xCF\x80M$z\xEF\xFF0\x85p\xB8\xB01f\r\e\xCE\x01\xC3\x01\x1E\x10' \x82\n\x01\x00;"
@v << gif @v << gif