From 5a13c6bcd9c7c138fdbedb92a56efea6f9535416 Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 16 Jun 2017 07:02:22 +0000 Subject: 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 --- test/psych/visitors/test_yaml_tree.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/psych/visitors/test_yaml_tree.rb') 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 -- cgit v1.2.3