diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 04:11:27 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 04:11:27 +0000 |
commit | 7309f9cc007f1cc05eb70967356069161d867356 (patch) | |
tree | 6dcfc346ff9055c7d938b8f01be917c6ed1edd98 /test/psych/test_deprecated.rb | |
parent | 655b2ade4984f8d0ad6c76d6eff35262ad7d2619 (diff) | |
download | ruby-7309f9cc007f1cc05eb70967356069161d867356.tar.gz |
* ext/psych/lib/psych.rb: supporting deprecated syck method
add_ruby_type
* ext/psych/lib/psych/visitors/to_ruby.rb: ditto
* test/psych/test_deprecated.rb: ditto
* test/psych/test_psych.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_deprecated.rb')
-rw-r--r-- | test/psych/test_deprecated.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb index 41106ffcfd..c93b36ed44 100644 --- a/test/psych/test_deprecated.rb +++ b/test/psych/test_deprecated.rb @@ -2,6 +2,10 @@ require_relative 'helper' module Psych class TestDeprecated < TestCase + def teardown + Psych.domain_types.clear + end + class QuickEmitter attr_reader :name attr_reader :value @@ -147,5 +151,17 @@ module Psych def test_yaml_as assert_match(/helloworld/, Psych.dump(YamlAs.new)) end + + def test_ruby_type + types = [] + appender = lambda { |*args| types << args } + + Psych.add_ruby_type('foo', &appender) + Psych.load <<-eoyml +- !ruby.yaml.org,2002/foo bar + eoyml + + assert_equal [["tag:ruby.yaml.org,2002:foo", "bar"]], types + end end end |