summaryrefslogtreecommitdiff
path: root/test/psych/test_coder.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-31 17:56:55 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-31 17:56:55 +0000
commit69c6ee0b45ad7e850dd0665c0f25d82602c49326 (patch)
tree022101b496ca6267c8db00d699a2449369e0de02 /test/psych/test_coder.rb
parent6024074540e3ea0e50f764900f94d2c641a3c1cc (diff)
* ext/psych/lib/psych/coder.rb: Adding Syck compatibility to the yaml coder
* test/psych/test_coder.rb: test for syck compatibility git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_coder.rb')
-rw-r--r--test/psych/test_coder.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb
index deef6f2..0fa01ca 100644
--- a/test/psych/test_coder.rb
+++ b/test/psych/test_coder.rb
@@ -89,6 +89,31 @@ module Psych
end
end
+ def test_map_takes_block
+ coder = Psych::Coder.new 'foo'
+ tag = coder.tag
+ style = coder.style
+ coder.map { |map| map.add 'foo', 'bar' }
+ assert_equal 'bar', coder['foo']
+ assert_equal tag, coder.tag
+ assert_equal style, coder.style
+ end
+
+ def test_map_with_tag
+ coder = Psych::Coder.new 'foo'
+ coder.map('hello') { |map| map.add 'foo', 'bar' }
+ assert_equal 'bar', coder['foo']
+ assert_equal 'hello', coder.tag
+ end
+
+ def test_map_with_tag_and_style
+ coder = Psych::Coder.new 'foo'
+ coder.map('hello', 'world') { |map| map.add 'foo', 'bar' }
+ assert_equal 'bar', coder['foo']
+ assert_equal 'hello', coder.tag
+ assert_equal 'world', coder.style
+ end
+
def test_represent_map
thing = Psych.load(Psych.dump(RepresentWithMap.new))
assert_equal({ 'a' => 'b' }, thing.map)