From: Ross Bamford Date: 2005-12-05T02:27:33+09:00 Subject: Re: PrettyPrint Array ? On Sun, 04 Dec 2005 13:50:34 -0000, Christer Nilsson wrote: > I'm trying to make my own simple assert, but have problem displaying > arrays. > > [...] > > The problem appears when displaying different values: > assert [1,2,[3]], [1,2,3] > > .. > expect: 123 > actual: 123 > .. > > which is not very helpful. > I'm not sure if this is what you're after, but if it's just about the displayed values try: def assert(expect, actual) print (expect == actual ? "." : "\nexpect #{expect.inspect}\nactual: #{actual.inspect}\n") end which yields: irb(main):029:0> assert([1,[2,3]], [1,2,3]) expect [1, [2, 3]] actual: [1, 2, 3] => nil Is that what you're after? -- Ross Bamford - rosco@roscopeco.remove.co.uk "\e[1;31mL"