When you use any of the test/unit methods, like "assert_equal", you
always get a nice output message like
1 tests, 2 assertions, 0 failures, 0 errors
or
<"CLARICE"> expected but was
<"JOHN">.
1 tests, 1 assertions, 1 failures, 0 errors
How can I manipulate that output message, for instance assign the whole
string from "<"CLARICE"> to "0 errors" to a variable?
It's not in $_ or $! or $stdout or $stdout, and I can't seem to assign
it to a variable. None of these work; the puts's are always "nil" or
something obscure from IO#:
a = assert_equal(x,y)
puts a
assert_equal(x,y)
puts $_
assert_equal(x,y)
puts $!
puts $stdout
puts $stdout
Well... What are you trying to accomplish? ZenTest's unit_diff works with output messages as a filter, so you just have to pipe your test/unit output through it.
···
On Oct 6, 2005, at 11:56 AM, Chris McMahon wrote:
When you use any of the test/unit methods, like "assert_equal", you
always get a nice output message like
1 tests, 2 assertions, 0 failures, 0 errors
or
<"CLARICE"> expected but was
<"JOHN">.
1 tests, 1 assertions, 1 failures, 0 errors
How can I manipulate that output message, for instance assign the whole
string from "<"CLARICE"> to "0 errors" to a variable?
--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04