In the course of revamping t/io/argv.t for VMS, I've added two
functions to t/test.pl.
isnt() is useful for replacing this sort of thing:
print "not " unless defined $foo;
print "ok 42\n";
with
isnt($foo, undef);
The advantage being if it fails $foo will be printed out.
next_test() just increments the test counter. This is good for tests
which just can't be wedged into the interface. It prints the ok, and
then next_test() is called to make test.pl's counter happy.
--- t/test.pl 2001/11/06 21:37:34 1.2
+++ t/test.pl 2001/11/06 21:49:34
@@ -79,6 +79,16 @@
_ok($pass, _where(), $name, @mess);
}
+sub isnt {
+ my ($got, $isnt, $name, @mess) = @_;
+ my $pass = $got ne $isnt;
+ unless( $pass ) {
+ unshift(@mess, "# it should not be $got\n",
+ "# but it is.\n");
+ }
+ _ok($pass, _where(), $name, @mess);
+}
+
# Note: this isn't quite as fancy as Test::More::like().
sub like {
my ($got, $expected, $name, @mess) = @_;
@@ -104,6 +114,10 @@
sub fail {
_ok(0, _where(), @_);
+}
+
+sub next_test {
+ $test++
}
# Note: can't pass multipart messages since we try to
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
Plus I remember being impressed with Ada because you could write an
infinite loop without a faked up condition. The idea being that in Ada
the typical infinite loop would be normally be terminated by detonation.
-- Larry Wall in <[EMAIL PROTECTED]>