From 6a75a460536a32fb62184dc5d8d66ddd737a9bad Mon Sep 17 00:00:00 2001 From: Richard Viney Date: Sun, 22 Jan 2017 14:50:08 +1300 Subject: =?UTF-8?q?Make=20prettyprint=E2=80=99s=20cycle=20detection=20awar?= =?UTF-8?q?e=20of=20Delegator=20instances?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes [Bug #13144] Co-Authored-By: Nobuyoshi Nakada --- test/test_pp.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/test_pp.rb') diff --git a/test/test_pp.rb b/test/test_pp.rb index 4736bff..3262417 100644 --- a/test/test_pp.rb +++ b/test/test_pp.rb @@ -184,6 +184,18 @@ class PPDelegateTest < Test::Unit::TestCase def test_delegate assert_equal("[]\n", A.new([]).pretty_inspect, "[ruby-core:25804]") end + + def test_delegate_cycle + a = HasPrettyPrint.new nil + + a.instance_eval {@a = a} + cycle_pretty_inspect = a.pretty_inspect + + a.instance_eval {@a = SimpleDelegator.new(a)} + delegator_cycle_pretty_inspect = a.pretty_inspect + + assert_equal(cycle_pretty_inspect, delegator_cycle_pretty_inspect) + end end class PPFileStatTest < Test::Unit::TestCase -- cgit v1.1