summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/Test/Simple.pm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/lib/Test/Simple.pm')
-rw-r--r--gnu/usr.bin/perl/lib/Test/Simple.pm53
1 files changed, 16 insertions, 37 deletions
diff --git a/gnu/usr.bin/perl/lib/Test/Simple.pm b/gnu/usr.bin/perl/lib/Test/Simple.pm
index 464fffd782f..319c7b23b39 100644
--- a/gnu/usr.bin/perl/lib/Test/Simple.pm
+++ b/gnu/usr.bin/perl/lib/Test/Simple.pm
@@ -2,23 +2,16 @@ package Test::Simple;
use 5.004;
-use strict 'vars';
-use vars qw($VERSION);
-$VERSION = '0.45';
+use strict;
+our $VERSION = '0.86';
+$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-use Test::Builder;
-my $Test = Test::Builder->new;
-
-sub import {
- my $self = shift;
- my $caller = caller;
- *{$caller.'::ok'} = \&ok;
-
- $Test->exported_to($caller);
- $Test->plan(@_);
-}
+use Test::Builder::Module;
+our @ISA = qw(Test::Builder::Module);
+our @EXPORT = qw(ok);
+my $CLASS = __PACKAGE__;
=head1 NAME
@@ -83,11 +76,10 @@ will do what you mean (fail if stuff is empty)
=cut
-sub ok ($;$) {
- $Test->ok(@_);
+sub ok ($;$) { ## no critic (Subroutines::ProhibitSubroutinePrototypes)
+ return $CLASS->builder->ok(@_);
}
-
=back
Test::Simple will start by printing number of tests run in the form
@@ -106,7 +98,7 @@ considered a failure and will exit with 255.
So the exit codes are...
0 all tests successful
- 255 test died
+ 255 test died or all passed but wrong # of tests run
any other number how many failed (including missing or extras)
If you fail more than 254 tests, it will be reported as 254.
@@ -129,7 +121,7 @@ Here's an example of a simple .t file for the fictional Film module.
Rating => 'R',
NumExplodingSheep => 1
});
- ok( defined($btaste) and ref $btaste eq 'Film', 'new() works' );
+ ok( defined($btaste) && ref $btaste eq 'Film, 'new() works' );
ok( $btaste->Title eq 'Bad Taste', 'Title() get' );
ok( $btaste->Director eq 'Peter Jackson', 'Director() get' );
@@ -143,7 +135,8 @@ It will produce output like this:
ok 2 - Title() get
ok 3 - Director() get
not ok 4 - Rating() get
- # Failed test (t/film.t at line 14)
+ # Failed test 'Rating() get'
+ # in t/film.t at line 14.
ok 5 - NumExplodingSheep() get
# Looks like you failed 1 tests of 5
@@ -196,24 +189,10 @@ Test::More. Test::Simple is 100% forward compatible with Test::More
(i.e. you can just use Test::More instead of Test::Simple in your
programs and things will still work).
-=item L<Test>
-
-The original Perl testing module.
-
-=item L<Test::Unit>
-
-Elaborate unit testing.
-
-=item L<Test::Inline>, L<SelfTest>
-
-Embed tests in your code!
-
-=item L<Test::Harness>
-
-Interprets the output of your test program.
-
=back
+Look in Test::More's SEE ALSO for more testing modules.
+
=head1 AUTHORS
@@ -223,7 +202,7 @@ E<lt>schwern@pobox.comE<gt>, wardrobe by Calvin Klein.
=head1 COPYRIGHT
-Copyright 2001 by Michael G Schwern E<lt>schwern@pobox.comE<gt>.
+Copyright 2001-2008 by Michael G Schwern E<lt>schwern@pobox.comE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.