[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

test/unit and pp

Patrick Gundlach

12/12/2005 11:27:00 AM

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
4 Answers

pat eyler

12/12/2005 3:44:00 PM

0

you should grab unitdiff from the ZenTest package, available at
http://rubyforge.org/project...

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

-pate

On 12/12/05, Patrick Gundlach <clr10.10.randomuser@spamgourmet.com> wrote:
> 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
>
>


--
thanks,
-pate
-------------------------


Patrick Gundlach

12/12/2005 4:53:00 PM

0


> you should grab unitdiff from the ZenTest package, available at
> http://rubyforge.org/project...
>
> 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.


[...]

>> 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>."

Patrick

pat eyler

12/12/2005 5:32:00 PM

0

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/project...
> >
> > 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.

>
> [...]
>
> >> 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>."
>
> Patrick
>
>


--
thanks,
-pate
-------------------------


James Gray

12/12/2005 7:02:00 PM

0

On Dec 12, 2005, at 11:07 AM, Patrick Gundlach wrote:

>
>> you should grab unitdiff from the ZenTest package, available at
>> http://rubyforge.org/project...
>>
>> 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