-#!./perl
+#!perl
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+use strict;
# For shutting up Test::Harness.
package My::Dev::Null;
use Tie::Handle;
-@ISA = qw(Tie::StdHandle);
+@My::Dev::Null::ISA = qw(Tie::StdHandle);
sub WRITE { }
my $test_num = 1;
sub ok ($;$) {
my($test, $name) = @_;
- print "not " unless $test;
- print "ok $test_num";
- print " - $name" if defined $name;
- print "\n";
+ my $okstring = '';
+ $okstring = "not " unless $test;
+ $okstring .= "ok $test_num";
+ $okstring .= " - $name" if defined $name;
+ print "$okstring\n";
$test_num++;
}
return $ok;
}
+use vars qw($Total_tests %samples);
my $loaded;
BEGIN { $| = 1; $^W = 1; }
simple => {
bonus => 0,
max => 5,
- ok => 5,
+ 'ok' => 5,
files => 1,
bad => 0,
good => 1,
simple_fail => {
bonus => 0,
max => 5,
- ok => 3,
+ 'ok' => 3,
files => 1,
bad => 1,
good => 0,
descriptive => {
bonus => 0,
max => 5,
- ok => 5,
+ 'ok' => 5,
files => 1,
bad => 0,
good => 1,
no_nums => {
bonus => 0,
max => 5,
- ok => 4,
+ 'ok' => 4,
files => 1,
bad => 1,
good => 0,
todo => {
bonus => 1,
max => 5,
- ok => 5,
+ 'ok' => 5,
files => 1,
bad => 0,
good => 1,
skip => {
bonus => 0,
max => 5,
- ok => 5,
+ 'ok' => 5,
files => 1,
bad => 0,
good => 1,
combined => {
bonus => 1,
max => 10,
- ok => 8,
+ 'ok' => 8,
files => 1,
bad => 1,
good => 0,
duplicates => {
bonus => 0,
max => 10,
- ok => 11,
+ 'ok' => 11,
files => 1,
bad => 1,
good => 0,
header_at_end => {
bonus => 0,
max => 4,
- ok => 4,
+ 'ok' => 4,
files => 1,
bad => 0,
good => 1,
skip_all => {
bonus => 0,
max => 0,
- ok => 0,
+ 'ok' => 0,
files => 1,
bad => 0,
good => 1,
with_comments => {
bonus => 2,
max => 5,
- ok => 5,
+ 'ok' => 5,
files => 1,
bad => 0,
good => 1,
tie *NULL, 'My::Dev::Null' or die $!;
while (my($test, $expect) = each %samples) {
- # _runtests() runs the tests but skips the formatting.
+ # _run_all_tests() runs the tests but skips the formatting.
my($totals, $failed);
eval {
- select NULL; # _runtests() isn't as quiet as it should be.
+ select NULL; # _run_all_tests() isn't as quiet as it should be.
($totals, $failed) =
- Test::Harness::_runtests("lib/sample-tests/$test");
+ Test::Harness::_run_all_tests("lib/sample-tests/$test");
};
select STDOUT;