summaryrefslogtreecommitdiff
path: root/test/psych/visitors
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/visitors')
-rw-r--r--test/psych/visitors/test_yaml_tree.rb17
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 ea38f6d6d44..8fc18f2fe66 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