4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
13 my $SAMPLE_TESTS = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
17 use Test::More tests => 35;
19 use_ok('Test::Harness::Straps');
21 my $IsVMS = $^O eq 'VMS';
23 # VMS uses native, not POSIX, exit codes.
24 my $die_exit = $IsVMS ? 44 : 1;
25 my $die_wait = $IsVMS ? 1024 : 256;
42 details => [ { 'ok' => 1, actual_ok => 1 },
43 { 'ok' => 1, actual_ok => 1,
44 name => 'basset hounds got long ears',
46 { 'ok' => 0, actual_ok => 0,
47 name => 'all hell broke lose',
49 { 'ok' => 1, actual_ok => 1,
52 { 'ok' => 1, actual_ok => 1 },
53 { 'ok' => 1, actual_ok => 1 },
54 { 'ok' => 1, actual_ok => 1,
56 reason => 'contract negociations'
58 { 'ok' => 1, actual_ok => 1 },
59 { 'ok' => 0, actual_ok => 0 },
60 { 'ok' => 1, actual_ok => 0,
80 details => [ { 'ok' => 1, actual_ok => 1,
81 name => 'Interlock activated'
83 { 'ok' => 1, actual_ok => 1,
84 name => 'Megathrusters are go',
86 { 'ok' => 1, actual_ok => 1,
87 name => 'Head formed',
89 { 'ok' => 1, actual_ok => 1,
90 name => 'Blazing sword formed'
92 { 'ok' => 1, actual_ok => 1,
93 name => 'Robeast destroyed'
112 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 10
130 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
148 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
166 details => [ { 'ok' => 1, actual_ok => 1 },
167 { 'ok' => 0, actual_ok => 0 },
168 ({ 'ok'=> 1, actual_ok => 1 }) x 2
186 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 5
204 details => [ { 'ok' => 1, actual_ok => 1 },
205 { 'ok' => 0, actual_ok => 0 },
206 { 'ok' => 1, actual_ok => 1 },
207 { 'ok' => 1, actual_ok => 1 },
208 { 'ok' => 0, actual_ok => 0 },
226 details => [ { 'ok' => 1, actual_ok => 1 },
227 { 'ok' => 1, actual_ok => 1,
229 reason => 'rain delay',
231 ({ 'ok' => 1, actual_ok => 1 }) x 3
267 details => [ { 'ok' => 1, actual_ok => 1 },
268 { 'ok' => 1, actual_ok => 1,
270 { 'ok' => 1, actual_ok => 0,
272 ({ 'ok' => 1, actual_ok => 1 }) x 2
289 details => [ { 'ok' => 1, actual_ok => 1,
290 name => '- -T honored'
308 details => [ { 'ok' => 0, actual_ok => 0 },
309 { 'ok' => 1, actual_ok => 1 },
343 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
361 details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
379 details => [ { 'ok' => 1, actual_ok => 1 },
380 { 'ok' => 1, actual_ok => 1 },
385 $SIG{__WARN__} = sub {
386 warn @_ unless $_[0] =~ /^Enourmous test number/ ||
387 $_[0] =~ /^Can't detailize/
389 while( my($test, $expect) = each %samples ) {
390 for (0..$#{$expect->{details}}) {
391 $expect->{details}[$_]{type} = ''
392 unless exists $expect->{details}[$_]{type};
393 $expect->{details}[$_]{name} = ''
394 unless exists $expect->{details}[$_]{name};
395 $expect->{details}[$_]{reason} = ''
396 unless exists $expect->{details}[$_]{reason};
399 my $strap = Test::Harness::Straps->new;
400 my %results = $strap->analyze_file("$SAMPLE_TESTS/$test");
402 is_deeply($results{details}, $expect->{details}, "$test details" );
404 delete $expect->{details};
405 delete $results{details};
406 is_deeply(\%results, $expect, " the rest $test" );