From 3a185ede69ac5845aebbde38dc8e6fbe4f64308a Mon Sep 17 00:00:00 2001 From: tenderlove Date: Wed, 7 Jul 2010 23:05:45 +0000 Subject: * ext/psych/lib/psych/visitors/emitter.rb: sending emit options to YAML emitter. [ruby-core:28318] * ext/psych/emitter.c: updating documentation about emit options * ext/psych/lib/psych/core_ext.rb: ditto * ext/psych/lib/psych.rb (dump): passing emit options to emitter. * ext/psych/lib/psych/nodes/node.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/psych/visitors/test_emitter.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/psych/visitors/test_emitter.rb') diff --git a/test/psych/visitors/test_emitter.rb b/test/psych/visitors/test_emitter.rb index bdae1bd855..7847cea3a5 100644 --- a/test/psych/visitors/test_emitter.rb +++ b/test/psych/visitors/test_emitter.rb @@ -9,6 +9,26 @@ module Psych @visitor = Visitors::Emitter.new @io end + def test_options + io = StringIO.new + visitor = Visitors::Emitter.new io, :indentation => 3 + + s = Nodes::Stream.new + doc = Nodes::Document.new + mapping = Nodes::Mapping.new + m2 = Nodes::Mapping.new + m2.children << Nodes::Scalar.new('a') + m2.children << Nodes::Scalar.new('b') + + mapping.children << Nodes::Scalar.new('key') + mapping.children << m2 + doc.children << mapping + s.children << doc + + visitor.accept s + assert_match(/^[ ]{3}a/, io.string) + end + def test_stream s = Nodes::Stream.new @visitor.accept s -- cgit v1.2.3