summaryrefslogtreecommitdiff
path: root/lib/pp.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-02 23:09:38 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-02 23:09:38 +0000
commit05172c42117ce60275d36e515c9ad7b9511b9c22 (patch)
treef8dbe78615215a4e87197b056d6f3e3a7228af3a /lib/pp.rb
parent847d01a7c3b01ed56e60196073bff431fc21d230 (diff)
* lib/pp.rb (Struct#pretty_print_cycle): follow 1.8 style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pp.rb')
-rw-r--r--lib/pp.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index a9491f62d2..8d8e640275 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -324,7 +324,7 @@ class Struct
end
def pretty_print_cycle(q)
- q.text sprintf("#<%s:...>", self.class.name)
+ q.text sprintf("#<struct %s:...>", self.class.name)
end
end
@@ -542,7 +542,7 @@ if __FILE__ == $0
result = PP.pp(a, '')
assert_equal("#{a.inspect}\n", result)
assert_match(/\A#<Object.*>\n\z/m, result)
- a = 1
+ a = 1.0
a.instance_eval { @a = nil }
result = PP.pp(a, '')
assert_equal("#{a.inspect}\n", result)
@@ -562,19 +562,22 @@ if __FILE__ == $0
a = []
a << a
assert_equal("[[...]]\n", PP.pp(a, ''))
+ assert_equal("#{a.inspect}\n", PP.pp(a, ''))
end
def test_hash
a = {}
a[0] = a
assert_equal("{0=>{...}}\n", PP.pp(a, ''))
+ assert_equal("#{a.inspect}\n", PP.pp(a, ''))
end
S = Struct.new("S", :a, :b)
def test_struct
a = S.new(1,2)
a.b = a
- assert_equal("#<struct Struct::S a=1, b=#<Struct::S:...>>\n", PP.pp(a, ''))
+ assert_equal("#<struct Struct::S a=1, b=#<struct Struct::S:...>>\n", PP.pp(a, ''))
+ assert_equal("#{a.inspect}\n", PP.pp(a, ''))
end
def test_object
@@ -592,6 +595,7 @@ if __FILE__ == $0
a = []
a << HasInspect.new(a)
assert_equal("[<inspect:[...]>]\n", PP.pp(a, ''))
+ assert_equal("#{a.inspect}\n", PP.pp(a, ''))
end
def test_share_nil