1 # Can't use Test.pm, that's a 5.005 thing.
5 if( $ENV{PERL_CORE} ) {
11 unless( eval { require File::Spec } ) {
12 print "1..0 # Skip Need File::Spec to run this test\n";
16 if( $^O eq 'VMS' && $] <= 5.00503 ) {
17 print "1..0 # Skip test will hang on older VMS perls\n";
22 # Utility testing functions.
24 my($test, $name) = @_;
26 $ok .= "not " unless $test;
27 $ok .= "ok $test_num";
28 $ok .= " - $name" if defined $name;
37 my $IsVMS = $^O eq 'VMS';
39 print "# Ahh! I see you're running VMS.\n" if $IsVMS;
43 'success.plx' => [0, 0],
44 'one_fail.plx' => [1, 4],
45 'two_fail.plx' => [2, 4],
46 'five_fail.plx' => [5, 4],
47 'extras.plx' => [3, 4],
48 'too_few.plx' => [4, 4],
49 'death.plx' => [255, 4],
50 'last_minute_death.plx' => [255, 4],
51 'death_in_eval.plx' => [0, 0],
52 'require.plx' => [0, 0],
55 print "1..".keys(%Tests)."\n";
58 my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests));
59 while( my($test_name, $exit_codes) = each %Tests ) {
60 my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0];
65 # VMS can't use its own $^X in a system call until almost 5.8
66 $Perl = "MCR $^X" if $] < 5.007003;
68 # Quiet noisy 'SYS$ABORT'. 'hushed' only exists in 5.6 and up,
69 # but it doesn't do any harm on eariler perls.
70 $Perl .= q{ -"Mvmsish=hushed"};
73 my $file = File::Spec->catfile($lib, $test_name);
74 my $wait_stat = system(qq{$Perl -"I../blib/lib" -"I../lib" -"I../t/lib" $file});
75 my $actual_exit = $wait_stat >> 8;
77 My::Test::ok( $actual_exit == $exit_code,
78 "$test_name exited with $actual_exit (expected $exit_code)");