test/unit and pp

P

Patrick Gundlach

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
 
P

pat eyler

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

Hi,

given the following program:

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


require 'test/unit'

class FooTester < Test::Unit::TestCase
def setup
@foo=3DArray.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=3Dfalse, somehow there is no difference
between those two (with and w/o use_pp=3Dfalse).

Patrick
 
P

Patrick Gundlach

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.


[...]
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
 
P

pat eyler

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
 
J

James Edward Gray II

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,514
Latest member
AdeleGelle

Latest Threads

Top