From 17b2deaa6e487e565d43c526a50d9974a54f5bbd Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 3 May 2010 08:17:12 -0700 Subject: merging from ruby --- test/psych/test_deprecated.rb | 19 +++++++++++++++++++ test/psych/visitors/test_yaml_tree.rb | 1 + 2 files changed, 20 insertions(+) (limited to 'test') diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb index 6db7238..a272db2 100644 --- a/test/psych/test_deprecated.rb +++ b/test/psych/test_deprecated.rb @@ -187,5 +187,24 @@ module Psych assert_equal Psych, Psych.tagurize(Psych) assert_equal 'tag:yaml.org,2002:foo', Psych.tagurize('foo') end + + def test_read_type_class + things = Psych.read_type_class 'tag:yaml.org,2002:int:Psych::TestDeprecated::QuickEmitter', Object + assert_equal 'int', things.first + assert_equal Psych::TestDeprecated::QuickEmitter, things.last + end + + def test_read_type_class_no_class + things = Psych.read_type_class 'tag:yaml.org,2002:int', Object + assert_equal 'int', things.first + assert_equal Object, things.last + end + + def test_object_maker + thing = Psych.object_maker(Object, { 'a' => 'b', 'c' => 'd' }) + assert_instance_of(Object, thing) + assert_equal 'b', thing.instance_variable_get(:@a) + assert_equal 'd', thing.instance_variable_get(:@c) + end end end diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb index 292710b..758cfae 100644 --- a/test/psych/visitors/test_yaml_tree.rb +++ b/test/psych/visitors/test_yaml_tree.rb @@ -23,6 +23,7 @@ module Psych def test_struct_const foo = Struct.new("Foo", :bar) assert_cycle foo.new('bar') + Struct.instance_eval { remove_const(:Foo) } end A = Struct.new(:foo) -- cgit v1.2.3