Big release here, folks. Lots of new stuff, knocked off a good chunk
of the TODO list.
http://www.pobox.com/~schwern/src/Test-Simple-0.40.tar.gz
0.40 Fri Dec 14 15:41:39 EST 2001
* isa_ok() now accepts unblessed references gracefully
- Nick Clark found a bug with like() and a regex with % in it.
- exit.t was hanging on 5.005_03 VMS perl. Test now skipped.
- can_ok() would pass if no methods were given. Now fails.
- isnt() diagnostic output format changed
* Added some docs about embedding and extending Test::More
* Added Test::More->builder
* Added cmp_ok()
* Added todo_skip()
* Added unlike()
- Piers pointed out that sometimes people override isa().
isa_ok() now accounts for that.
Here's the juicy bits:
isa_ok()
Handles unblessed refs now -> isa_ok([], 'ARRAY');
Better diagnostics.
not ok 1 - The object isa Bar
# Failed test (-e at line 1)
# The object isn't a 'Bar' its a 'Foo'
cmp_ok()
The is_op() thing I was talking about. Nick, no more need to lie
awake at night worrying about testing numbers with is().
cmp_ok($some_horrendous_number, '==', $another_massive_number);
# Failed test (-e at line 1)
# got: 2420983.14598
# expected: 2420983.145981
In the == case the diagnostics force numeric context, so you can
safely do things like:
cmp_ok($!, '==', 5);
# Failed test (-e at line 1)
# got: 2
# expected: 5
cmp_ok($!, 'eq', "No such file or martian");
# Failed test (-e at line 1)
# got: 'No such file or directory'
# expected: 'No such file or martian'
but it means you also get:
cmp_ok("foo", '==', 5);
# Failed test (-e at line 1)
# got: 0
# expected: 5
which I think is the Right Thing. Thoughts?
I've gone through some pains to make the diagnostic output come
out just right, but I still think it looks a little ugly in the
non 'eq' and '==' cases.
cmp_ok(0, "&&", "foo")'
# Failed test (-e at line 1)
# '0'
# &&
# 'foo'
Let me know what you think.
Test::More->builder
Used to be to get access to the Test::Builder object underlying
Test::Builder you'd just call Test::Builder->new. In order to
cover my ass in case I discover that's a bad idea,
Test::More->builder is now the official way to get at the underlying
object. Though I just realized I left a bunch of Test::Builder->new
calls in the tests.
unlike()
Opposite of like()
todo_skip()
Combines a todo test with skip's ability to jump whole blocks.
Useful for when a todo test can't be run at all because it will
die or otherwise cause havoc. Doesn't come up all that often,
but I found myself needing it a few times in the core tests.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
GOD made us funky!