summaryrefslogtreecommitdiff
path: root/test/psych/visitors
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-16 07:02:22 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-16 07:02:22 +0000
commit5a13c6bcd9c7c138fdbedb92a56efea6f9535416 (patch)
tree06b6846cff862abde4526a2b0f997535926d96d9 /test/psych/visitors
parentab8e756de0f88f1841510a4043558c0f4d28c5cc (diff)
downloadruby-5a13c6bcd9c7c138fdbedb92a56efea6f9535416.tar.gz
Merge psych-3.0.0.beta2 from https://github.com/ruby/psych
It contains following changes from 3.0.0.beta1 * Preserve time zone offset when deserializing times https://github.com/ruby/psych/pull/316 * Enable YAML serialization of Ruby delegators https://github.com/ruby/psych/pull/158 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 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