diff options
Diffstat (limited to 'test/psych/visitors/test_yaml_tree.rb')
-rw-r--r-- | test/psych/visitors/test_yaml_tree.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb index ea38f6d6d4..8fc18f2fe6 100644 --- a/test/psych/visitors/test_yaml_tree.rb +++ b/test/psych/visitors/test_yaml_tree.rb @@ -4,6 +4,15 @@ require 'psych/helper' module Psych module Visitors class TestYAMLTree < TestCase + class TestDelegatorClass < Delegator + def initialize(obj); super; @obj = obj; end + def __setobj__(obj); @obj = obj; end + def __getobj__; @obj; end + end + + class TestSimpleDelegatorClass < SimpleDelegator + end + def setup super @v = Visitors::YAMLTree.create @@ -175,6 +184,14 @@ module Psych assert_cycle 'nUll' assert_cycle '~' end + + def test_delegator + assert_cycle(TestDelegatorClass.new([1, 2, 3])) + end + + def test_simple_delegator + assert_cycle(TestSimpleDelegatorClass.new([1, 2, 3])) + end end end end |