6 # Can't use Test.pm, that's a 5.005 thing.
12 # Utility testing functions.
14 my($test, $name) = @_;
16 $ok .= "not " unless $test;
17 $ok .= "ok $test_num";
18 $ok .= " - $name" if defined $name;
27 my $IsVMS = $^O eq 'VMS';
29 print "# Ahh! I see you're running VMS.\n" if $IsVMS;
33 'success.plx' => [0, 0],
34 'one_fail.plx' => [1, 4],
35 'two_fail.plx' => [2, 4],
36 'five_fail.plx' => [5, 4],
37 'extras.plx' => [3, 4],
38 'too_few.plx' => [4, 4],
39 'death.plx' => [255, 4],
40 'last_minute_death.plx' => [255, 4],
41 'death_in_eval.plx' => [0, 0],
42 'require.plx' => [0, 0],
45 print "1..".keys(%Tests)."\n";
47 my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests));
48 while( my($test_name, $exit_codes) = each %Tests ) {
49 my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0];
51 my $file = File::Spec->catfile($lib, $test_name);
52 my $wait_stat = system(qq{$^X -"I../lib" -"I../t/lib" $file});
53 my $actual_exit = $wait_stat >> 8;
55 My::Test::ok( $actual_exit == $exit_code,
56 "$test_name exited with $actual_exit (expected $exit_code)");