summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_deprecated.rb19
-rw-r--r--test/psych/visitors/test_yaml_tree.rb1
2 files changed, 20 insertions, 0 deletions
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)