aboutsummaryrefslogtreecommitdiffstats
path: root/test/psych/test_coder.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-19 23:05:53 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-19 23:05:53 +0000
commita17cdfdde29faa7e6c5feb1c31d41e4f42328daa (patch)
tree9abdd148b52ae4019955d386c3aabaedc5cac723 /test/psych/test_coder.rb
parent64847a9cfe467b808ca5e8148dfa85a059198963 (diff)
downloadruby-a17cdfdde29faa7e6c5feb1c31d41e4f42328daa.tar.gz
* ext/psych/lib/psych/coder.rb (represent_object): arbitrary objects
may be passed to the Psych::Coder object. * ext/psych/lib/psych/visitors/yaml_tree.rb: support for visiting arbitrary objects set on the coder. * test/psych/test_coder.rb: supporting test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_coder.rb')
-rw-r--r--test/psych/test_coder.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb
index c171c5ad0d..4809b13d5d 100644
--- a/test/psych/test_coder.rb
+++ b/test/psych/test_coder.rb
@@ -89,6 +89,17 @@ module Psych
end
end
+ class RepresentWithObject
+ def encode_with coder
+ coder.represent_object self.class.name, 20
+ end
+ end
+
+ def test_represent_with_object
+ thing = Psych.load(Psych.dump(RepresentWithObject.new))
+ assert_equal 20, thing
+ end
+
def test_json_dump_exclude_tag
refute_match('TestCoder::InitApi', Psych.to_json(InitApi.new))
end