From 60bdcfd6b662f5d602f51559950fcac6c43bcf3d Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 15 Jan 2009 15:38:08 +0000 Subject: merges r21496 from trunk into ruby_1_9_1. * lib/ostruct.rb (OpenStruct#inspect): fixed the recursion check. Patch by Kornelius Kalnbach. [ruby-core:20992]. * test/ostruct/test_ostruct.rb: test for inspect. Patch by Kornelius Kalnbach. [ruby-core:20992]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ostruct/test_ostruct.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ostruct') diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 24ed17f80..79662c643 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -20,4 +20,18 @@ class TC_OpenStruct < Test::Unit::TestCase o2.instance_eval{@table = {:a => 'b'}} assert_not_equal(o1, o2) end + + def test_inspect + foo = OpenStruct.new + assert_equal("#", foo.inspect) + foo.bar = 1 + foo.baz = 2 + assert_equal("#", foo.inspect) + + foo = OpenStruct.new + foo.bar = OpenStruct.new + assert_equal('#>', foo.inspect) + foo.bar.foo = foo + assert_equal('#>>', foo.inspect) + end end -- cgit