Forum: Ruby test/unit and pp

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9035814d8b0ac979bf1c8f46f1f04140?d=identicon&s=25 Patrick Gundlach (Guest)
on 2005-12-12 13:11
(Received via mailing list)
Hi,

given the following program:

--------------------------------------------------
#!/opt/ruby/1.8/bin/ruby -w


require 'test/unit'

class FooTester < Test::Unit::TestCase
  def setup
    @foo=Array.new
    @foo << [:a,:b,[:c]]
  end
  def test_foo
    assert_instance_of Hash,@foo
  end
end

--------------------------------------------------

I'd like to have the

"  1) Failure:
test_foo(FooTester) [-:16]:
<[[:a, :b, [:c]]]> expected to be an instance of
<Hash> but was
<Array>."

written a bit shorter, perhaps like this:

"  1) Failure:
test_foo(FooTester) [-:16]:
instance of <Hash> expected but was <Array>."

because sometimes I have very large objects to compare. I was not
successful by setting use_pp=false, somehow there is no difference
between those two (with and w/o use_pp=false).

Patrick
Bb6ecee0238ef2461bef3416722b35c5?d=identicon&s=25 pat eyler (Guest)
on 2005-12-12 16:48
(Received via mailing list)
you should grab unitdiff from the ZenTest package, available at
http://rubyforge.org/projects/zentest/

it will work wonders on cleaning up large amounts of testing feedback.

-pate
9035814d8b0ac979bf1c8f46f1f04140?d=identicon&s=25 Patrick Gundlach (Guest)
on 2005-12-12 18:09
(Received via mailing list)
> you should grab unitdiff from the ZenTest package, available at
> http://rubyforge.org/projects/zentest/
>
> it will work wonders on cleaning up large amounts of testing feedback.

does it also clean up the messages? Couldn't find anything in the docs
about it.


[...]

>> "  1) Failure:
>> test_foo(FooTester) [-:16]:
>> instance of <Hash> expected but was <Array>."

Patrick
Bb6ecee0238ef2461bef3416722b35c5?d=identicon&s=25 pat eyler (Guest)
on 2005-12-12 18:34
(Received via mailing list)
On 12/12/05, Patrick Gundlach <clr10.10.randomuser@spamgourmet.com>
wrote:
>
> > you should grab unitdiff from the ZenTest package, available at
> > http://rubyforge.org/projects/zentest/
> >
> > it will work wonders on cleaning up large amounts of testing feedback.
>
> does it also clean up the messages? Couldn't find anything in the docs
> about it.
>

Ahh, I misread your request.  No it doesn't clean up the message.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2005-12-12 20:04
(Received via mailing list)
On Dec 12, 2005, at 11:07 AM, Patrick Gundlach wrote:

>
>> you should grab unitdiff from the ZenTest package, available at
>> http://rubyforge.org/projects/zentest/
>>
>> it will work wonders on cleaning up large amounts of testing
>> feedback.
>
> does it also clean up the messages? Couldn't find anything in the docs
> about it.

Yes and no.  It show's a diff of the two items that were suppose to
be equal.  This is almost a required feature when working with
assert_tag() in Rails, for example.

James Edward Gray II
This topic is locked and can not be replied to.