Commit | Line | Data |
---|---|---|
15db8fc4 JH |
1 | BEGIN { |
2 | chdir 't' if -d 't'; | |
3 | @INC = '../lib'; | |
15db8fc4 JH |
4 | } |
5 | ||
4dd974da JH |
6 | # Can't use Test.pm, that's a 5.005 thing. |
7 | package My::Test; | |
8 | ||
0cd946aa MS |
9 | use File::Spec; |
10 | ||
4dd974da JH |
11 | my $test_num = 1; |
12 | # Utility testing functions. | |
13 | sub ok ($;$) { | |
14 | my($test, $name) = @_; | |
11ea77c5 JH |
15 | my $ok = ''; |
16 | $ok .= "not " unless $test; | |
17 | $ok .= "ok $test_num"; | |
18 | $ok .= " - $name" if defined $name; | |
19 | $ok .= "\n"; | |
20 | print $ok; | |
4dd974da JH |
21 | $test_num++; |
22 | } | |
23 | ||
24 | ||
25 | package main; | |
26 | ||
d020a79a JH |
27 | my $IsVMS = $^O eq 'VMS'; |
28 | ||
29 | print "# Ahh! I see you're running VMS.\n" if $IsVMS; | |
30 | ||
4dd974da | 31 | my %Tests = ( |
d020a79a JH |
32 | # Everyone Else VMS |
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], | |
4dd974da JH |
43 | ); |
44 | ||
45 | print "1..".keys(%Tests)."\n"; | |
46 | ||
0cd946aa | 47 | my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests)); |
d020a79a JH |
48 | while( my($test_name, $exit_codes) = each %Tests ) { |
49 | my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0]; | |
12b8e1e4 | 50 | |
15db8fc4 | 51 | my $file = File::Spec->catfile($lib, $test_name); |
15db8fc4 | 52 | my $wait_stat = system(qq{$^X -"I../lib" -"I../t/lib" $file}); |
d020a79a | 53 | my $actual_exit = $wait_stat >> 8; |
12b8e1e4 | 54 | |
d020a79a JH |
55 | My::Test::ok( $actual_exit == $exit_code, |
56 | "$test_name exited with $actual_exit (expected $exit_code)"); | |
57 | } |