1#!/usr/bin/perl -w
2
3BEGIN {
4    push @INC, 't/lib';
5}
6
7use strict;
8
9use Test::More 'no_plan';
10
11use File::Spec;
12use Config;
13
14use constant TRUE  => "__TRUE__";
15use constant FALSE => "__FALSE__";
16
17# if wait() is non-zero, we cannot reliably predict its value
18use constant NOT_ZERO => "__NOT_ZERO__";
19
20use TAP::Parser;
21
22my $IsVMS   = $^O eq 'VMS';
23my $IsWin32 = $^O eq 'MSWin32';
24
25my $SAMPLE_TESTS = File::Spec->catdir(
26    File::Spec->curdir,
27    't',
28    'sample-tests'
29);
30
31my %deprecated = map { $_ => 1 } qw(
32  TAP::Parser::good_plan
33  TAP::Parser::Result::Plan::passed
34  TAP::Parser::Result::Test::passed
35  TAP::Parser::Result::Test::actual_passed
36  TAP::Parser::Result::passed
37);
38$SIG{__WARN__} = sub {
39    if ( $_[0] =~ /is deprecated/ ) {
40        my @caller = caller(1);
41        my $sub    = $caller[3];
42        ok exists $deprecated{$sub},
43          "... we should get a deprecated warning for $sub";
44    }
45    else {
46        CORE::warn @_;
47    }
48};
49
50# the %samples keys are the names of test scripts in t/sample-tests
51my %samples = (
52    descriptive => {
53        results => [
54            {   is_plan       => TRUE,
55                raw           => '1..5',
56                tests_planned => 5,
57                passed        => TRUE,
58                is_ok         => TRUE,
59            },
60            {   actual_passed => TRUE,
61                is_actual_ok  => TRUE,
62                description   => "Interlock activated",
63                passed        => TRUE,
64                is_ok         => TRUE,
65                is_test       => TRUE,
66                has_skip      => FALSE,
67                has_todo      => FALSE,
68                number        => 1,
69                is_unplanned  => FALSE,
70            },
71            {   actual_passed => TRUE,
72                is_actual_ok  => TRUE,
73                passed        => TRUE,
74                is_ok         => TRUE,
75                is_test       => TRUE,
76                has_skip      => FALSE,
77                has_todo      => FALSE,
78                number        => 2,
79                description   => "Megathrusters are go",
80                is_unplanned  => FALSE,
81            },
82            {   actual_passed => TRUE,
83                is_actual_ok  => TRUE,
84                passed        => TRUE,
85                is_ok         => TRUE,
86                is_test       => TRUE,
87                has_skip      => FALSE,
88                has_todo      => FALSE,
89                number        => 3,
90                description   => "Head formed",
91                is_unplanned  => FALSE,
92            },
93            {   actual_passed => TRUE,
94                is_actual_ok  => TRUE,
95                passed        => TRUE,
96                is_ok         => TRUE,
97                is_test       => TRUE,
98                has_skip      => FALSE,
99                has_todo      => FALSE,
100                number        => 4,
101                description   => "Blazing sword formed",
102                is_unplanned  => FALSE,
103            },
104            {   actual_passed => TRUE,
105                is_actual_ok  => TRUE,
106                passed        => TRUE,
107                is_ok         => TRUE,
108                is_test       => TRUE,
109                has_skip      => FALSE,
110                has_todo      => FALSE,
111                number        => 5,
112                description   => "Robeast destroyed",
113                is_unplanned  => FALSE,
114            }
115        ],
116        plan          => '1..5',
117        passed        => [ 1 .. 5 ],
118        actual_passed => [ 1 .. 5 ],
119        failed        => [],
120        actual_failed => [],
121        todo          => [],
122        todo_passed   => [],
123        skipped       => [],
124        good_plan     => TRUE,
125        is_good_plan  => TRUE,
126        tests_planned => 5,
127        tests_run     => 5,
128        parse_errors  => [],
129        'exit'        => 0,
130        wait          => 0,
131        version       => 12,
132    },
133    descriptive_trailing => {
134        results => [
135            {   actual_passed => TRUE,
136                is_actual_ok  => TRUE,
137                description   => "Interlock activated",
138                passed        => TRUE,
139                is_ok         => TRUE,
140                is_test       => TRUE,
141                has_skip      => FALSE,
142                has_todo      => FALSE,
143                number        => 1,
144                is_unplanned  => FALSE,
145            },
146            {   actual_passed => TRUE,
147                is_actual_ok  => TRUE,
148                passed        => TRUE,
149                is_ok         => TRUE,
150                is_test       => TRUE,
151                has_skip      => FALSE,
152                has_todo      => FALSE,
153                number        => 2,
154                description   => "Megathrusters are go",
155                is_unplanned  => FALSE,
156            },
157            {   actual_passed => TRUE,
158                is_actual_ok  => TRUE,
159                passed        => TRUE,
160                is_ok         => TRUE,
161                is_test       => TRUE,
162                has_skip      => FALSE,
163                has_todo      => FALSE,
164                number        => 3,
165                description   => "Head formed",
166                is_unplanned  => FALSE,
167            },
168            {   actual_passed => TRUE,
169                is_actual_ok  => TRUE,
170                passed        => TRUE,
171                is_ok         => TRUE,
172                is_test       => TRUE,
173                has_skip      => FALSE,
174                has_todo      => FALSE,
175                number        => 4,
176                description   => "Blazing sword formed",
177                is_unplanned  => FALSE,
178            },
179            {   actual_passed => TRUE,
180                is_actual_ok  => TRUE,
181                passed        => TRUE,
182                is_ok         => TRUE,
183                is_test       => TRUE,
184                has_skip      => FALSE,
185                has_todo      => FALSE,
186                number        => 5,
187                description   => "Robeast destroyed",
188                is_unplanned  => FALSE,
189            },
190            {   is_plan       => TRUE,
191                raw           => '1..5',
192                tests_planned => 5,
193                passed        => TRUE,
194                is_ok         => TRUE,
195            },
196        ],
197        plan          => '1..5',
198        passed        => [ 1 .. 5 ],
199        actual_passed => [ 1 .. 5 ],
200        failed        => [],
201        actual_failed => [],
202        todo          => [],
203        todo_passed   => [],
204        skipped       => [],
205        good_plan     => TRUE,
206        is_good_plan  => TRUE,
207        tests_planned => 5,
208        tests_run     => 5,
209        parse_errors  => [],
210        'exit'        => 0,
211        wait          => 0,
212        version       => 12,
213    },
214    empty => {
215        results       => [],
216        plan          => '',
217        passed        => [],
218        actual_passed => [],
219        failed        => [],
220        actual_failed => [],
221        todo          => [],
222        todo_passed   => [],
223        skipped       => [],
224        good_plan     => FALSE,
225        is_good_plan  => FALSE,
226        tests_planned => undef,
227        tests_run     => 0,
228        parse_errors  => ['No plan found in TAP output'],
229        'exit'        => 0,
230        wait          => 0,
231        version       => 12,
232    },
233    simple => {
234        results => [
235            {   is_plan       => TRUE,
236                raw           => '1..5',
237                tests_planned => 5,
238                passed        => TRUE,
239                is_ok         => TRUE,
240            },
241            {   actual_passed => TRUE,
242                is_actual_ok  => TRUE,
243                passed        => TRUE,
244                is_ok         => TRUE,
245                is_test       => TRUE,
246                has_skip      => FALSE,
247                has_todo      => FALSE,
248                number        => 1,
249                description   => "",
250            },
251            {   actual_passed => TRUE,
252                is_actual_ok  => TRUE,
253                passed        => TRUE,
254                is_ok         => TRUE,
255                is_test       => TRUE,
256                has_skip      => FALSE,
257                has_todo      => FALSE,
258                number        => 2,
259                description   => "",
260            },
261            {   actual_passed => TRUE,
262                is_actual_ok  => TRUE,
263                passed        => TRUE,
264                is_ok         => TRUE,
265                is_test       => TRUE,
266                has_skip      => FALSE,
267                has_todo      => FALSE,
268                number        => 3,
269                description   => "",
270            },
271            {   actual_passed => TRUE,
272                is_actual_ok  => TRUE,
273                passed        => TRUE,
274                is_ok         => TRUE,
275                is_test       => TRUE,
276                has_skip      => FALSE,
277                has_todo      => FALSE,
278                number        => 4,
279                description   => "",
280            },
281            {   actual_passed => TRUE,
282                is_actual_ok  => TRUE,
283                passed        => TRUE,
284                is_ok         => TRUE,
285                is_test       => TRUE,
286                has_skip      => FALSE,
287                has_todo      => FALSE,
288                number        => 5,
289                description   => "",
290            },
291        ],
292        plan          => '1..5',
293        passed        => [ 1 .. 5 ],
294        actual_passed => [ 1 .. 5 ],
295        failed        => [],
296        actual_failed => [],
297        todo          => [],
298        todo_passed   => [],
299        skipped       => [],
300        good_plan     => TRUE,
301        is_good_plan  => TRUE,
302        tests_planned => 5,
303        tests_run     => 5,
304        parse_errors  => [],
305        'exit'        => 0,
306        wait          => 0,
307        version       => 12,
308    },
309    space_after_plan => {
310        results => [
311            {   is_plan       => TRUE,
312                raw           => '1..5 ',
313                tests_planned => 5,
314                passed        => TRUE,
315                is_ok         => TRUE,
316            },
317            {   actual_passed => TRUE,
318                is_actual_ok  => TRUE,
319                passed        => TRUE,
320                is_ok         => TRUE,
321                is_test       => TRUE,
322                has_skip      => FALSE,
323                has_todo      => FALSE,
324                number        => 1,
325                description   => "",
326            },
327            {   actual_passed => TRUE,
328                is_actual_ok  => TRUE,
329                passed        => TRUE,
330                is_ok         => TRUE,
331                is_test       => TRUE,
332                has_skip      => FALSE,
333                has_todo      => FALSE,
334                number        => 2,
335                description   => "",
336            },
337            {   actual_passed => TRUE,
338                is_actual_ok  => TRUE,
339                passed        => TRUE,
340                is_ok         => TRUE,
341                is_test       => TRUE,
342                has_skip      => FALSE,
343                has_todo      => FALSE,
344                number        => 3,
345                description   => "",
346            },
347            {   actual_passed => TRUE,
348                is_actual_ok  => TRUE,
349                passed        => TRUE,
350                is_ok         => TRUE,
351                is_test       => TRUE,
352                has_skip      => FALSE,
353                has_todo      => FALSE,
354                number        => 4,
355                description   => "",
356            },
357            {   actual_passed => TRUE,
358                is_actual_ok  => TRUE,
359                passed        => TRUE,
360                is_ok         => TRUE,
361                is_test       => TRUE,
362                has_skip      => FALSE,
363                has_todo      => FALSE,
364                number        => 5,
365                description   => "",
366            },
367        ],
368        plan          => '1..5',
369        passed        => [ 1 .. 5 ],
370        actual_passed => [ 1 .. 5 ],
371        failed        => [],
372        actual_failed => [],
373        todo          => [],
374        todo_passed   => [],
375        skipped       => [],
376        good_plan     => TRUE,
377        is_good_plan  => TRUE,
378        tests_planned => 5,
379        tests_run     => 5,
380        parse_errors  => [],
381        'exit'        => 0,
382        wait          => 0,
383        version       => 12,
384    },
385    simple_yaml => {
386        results => [
387            {   is_version => TRUE,
388                raw        => 'TAP version 13',
389            },
390            {   is_plan       => TRUE,
391                raw           => '1..5',
392                tests_planned => 5,
393                passed        => TRUE,
394                is_ok         => TRUE,
395            },
396            {   actual_passed => TRUE,
397                is_actual_ok  => TRUE,
398                passed        => TRUE,
399                is_ok         => TRUE,
400                is_test       => TRUE,
401                has_skip      => FALSE,
402                has_todo      => FALSE,
403                number        => 1,
404                description   => "",
405            },
406            {   actual_passed => TRUE,
407                is_actual_ok  => TRUE,
408                passed        => TRUE,
409                is_ok         => TRUE,
410                is_test       => TRUE,
411                has_skip      => FALSE,
412                has_todo      => FALSE,
413                number        => 2,
414                description   => "",
415            },
416            {   is_yaml => TRUE,
417                data    => [
418                    { 'fnurk' => 'skib', 'ponk' => 'gleeb' },
419                    { 'bar'   => 'krup', 'foo'  => 'plink' }
420                ],
421                raw =>
422                  "  ---\n  -\n    fnurk: skib\n    ponk: gleeb\n  -\n    bar: krup\n    foo: plink\n  ...",
423            },
424            {   actual_passed => TRUE,
425                is_actual_ok  => TRUE,
426                passed        => TRUE,
427                is_ok         => TRUE,
428                is_test       => TRUE,
429                has_skip      => FALSE,
430                has_todo      => FALSE,
431                number        => 3,
432                description   => "",
433            },
434            {   actual_passed => TRUE,
435                is_actual_ok  => TRUE,
436                passed        => TRUE,
437                is_ok         => TRUE,
438                is_test       => TRUE,
439                has_skip      => FALSE,
440                has_todo      => FALSE,
441                number        => 4,
442                description   => "",
443            },
444            {   is_yaml => TRUE,
445                data    => {
446                    'got'      => [ '1', 'pong', '4' ],
447                    'expected' => [ '1', '2',    '4' ]
448                },
449                raw =>
450                  "  ---\n  expected:\n    - 1\n    - 2\n    - 4\n  got:\n    - 1\n    - pong\n    - 4\n  ...",
451            },
452            {   actual_passed => TRUE,
453                is_actual_ok  => TRUE,
454                passed        => TRUE,
455                is_ok         => TRUE,
456                is_test       => TRUE,
457                has_skip      => FALSE,
458                has_todo      => FALSE,
459                number        => 5,
460                description   => "",
461            },
462        ],
463        plan          => '1..5',
464        passed        => [ 1 .. 5 ],
465        actual_passed => [ 1 .. 5 ],
466        failed        => [],
467        actual_failed => [],
468        todo          => [],
469        todo_passed   => [],
470        skipped       => [],
471        good_plan     => TRUE,
472        is_good_plan  => TRUE,
473        tests_planned => 5,
474        tests_run     => 5,
475        parse_errors  => [],
476        'exit'        => 0,
477        wait          => 0,
478        version       => 13,
479    },
480    simple_fail => {
481        results => [
482            {   is_plan       => TRUE,
483                raw           => '1..5',
484                tests_planned => 5,
485                passed        => TRUE,
486                is_ok         => TRUE,
487            },
488            {   actual_passed => TRUE,
489                is_actual_ok  => TRUE,
490                passed        => TRUE,
491                is_ok         => TRUE,
492                is_test       => TRUE,
493                has_skip      => FALSE,
494                has_todo      => FALSE,
495                number        => 1,
496                description   => "",
497            },
498            {   actual_passed => FALSE,
499                is_actual_ok  => FALSE,
500                passed        => FALSE,
501                is_ok         => FALSE,
502                is_test       => TRUE,
503                has_skip      => FALSE,
504                has_todo      => FALSE,
505                number        => 2,
506                description   => "",
507            },
508            {   actual_passed => TRUE,
509                is_actual_ok  => TRUE,
510                passed        => TRUE,
511                is_ok         => TRUE,
512                is_test       => TRUE,
513                has_skip      => FALSE,
514                has_todo      => FALSE,
515                number        => 3,
516                description   => "",
517            },
518            {   actual_passed => TRUE,
519                is_actual_ok  => TRUE,
520                passed        => TRUE,
521                is_ok         => TRUE,
522                is_test       => TRUE,
523                has_skip      => FALSE,
524                has_todo      => FALSE,
525                number        => 4,
526                description   => "",
527            },
528            {   actual_passed => FALSE,
529                is_actual_ok  => FALSE,
530                passed        => FALSE,
531                is_ok         => FALSE,
532                is_test       => TRUE,
533                has_skip      => FALSE,
534                has_todo      => FALSE,
535                number        => 5,
536                description   => "",
537            },
538        ],
539        plan          => '1..5',
540        passed        => [ 1, 3, 4 ],
541        actual_passed => [ 1, 3, 4 ],
542        failed        => [ 2, 5 ],
543        actual_failed => [ 2, 5 ],
544        todo          => [],
545        todo_passed   => [],
546        skipped       => [],
547        good_plan     => TRUE,
548        is_good_plan  => TRUE,
549        tests_planned => 5,
550        tests_run     => 5,
551        parse_errors  => [],
552        'exit'        => 0,
553        wait          => 0,
554        version       => 12,
555    },
556    skip => {
557        results => [
558            {   is_plan       => TRUE,
559                raw           => '1..5',
560                tests_planned => 5,
561                passed        => TRUE,
562                is_ok         => TRUE,
563            },
564            {   actual_passed => TRUE,
565                is_actual_ok  => TRUE,
566                passed        => TRUE,
567                is_ok         => TRUE,
568                is_test       => TRUE,
569                has_skip      => FALSE,
570                has_todo      => FALSE,
571                number        => 1,
572                description   => "",
573            },
574            {   actual_passed => TRUE,
575                is_actual_ok  => TRUE,
576                passed        => TRUE,
577                is_ok         => TRUE,
578                is_test       => TRUE,
579                has_skip      => TRUE,
580                has_todo      => FALSE,
581                number        => 2,
582                description   => "",
583                explanation   => 'rain delay',
584            },
585            {   actual_passed => TRUE,
586                is_actual_ok  => TRUE,
587                passed        => TRUE,
588                is_ok         => TRUE,
589                is_test       => TRUE,
590                has_skip      => FALSE,
591                has_todo      => FALSE,
592                number        => 3,
593                description   => "",
594            },
595            {   actual_passed => TRUE,
596                is_actual_ok  => TRUE,
597                passed        => TRUE,
598                is_ok         => TRUE,
599                is_test       => TRUE,
600                has_skip      => FALSE,
601                has_todo      => FALSE,
602                number        => 4,
603                description   => "",
604            },
605            {   actual_passed => TRUE,
606                is_actual_ok  => TRUE,
607                passed        => TRUE,
608                is_ok         => TRUE,
609                is_test       => TRUE,
610                has_skip      => FALSE,
611                has_todo      => FALSE,
612                number        => 5,
613                description   => "",
614            },
615        ],
616        plan          => '1..5',
617        passed        => [ 1 .. 5 ],
618        actual_passed => [ 1 .. 5 ],
619        failed        => [],
620        actual_failed => [],
621        todo          => [],
622        todo_passed   => [],
623        skipped       => [2],
624        good_plan     => TRUE,
625        is_good_plan  => TRUE,
626        tests_planned => 5,
627        tests_run     => 5,
628        parse_errors  => [],
629        'exit'        => 0,
630        wait          => 0,
631        version       => 12,
632    },
633    skip_nomsg => {
634        results => [
635            {   is_plan       => TRUE,
636                passed        => TRUE,
637                is_ok         => TRUE,
638                raw           => '1..1',
639                tests_planned => 1,
640            },
641            {   actual_passed => TRUE,
642                is_actual_ok  => TRUE,
643                passed        => TRUE,
644                is_ok         => TRUE,
645                is_test       => TRUE,
646                has_skip      => TRUE,
647                has_todo      => FALSE,
648                number        => 1,
649                description   => "",
650                explanation   => '',
651            },
652        ],
653        plan          => '1..1',
654        passed        => [1],
655        actual_passed => [1],
656        failed        => [],
657        actual_failed => [],
658        todo          => [],
659        todo_passed   => [],
660        skipped       => [1],
661        good_plan     => TRUE,
662        is_good_plan  => TRUE,
663        tests_planned => 1,
664        tests_run     => TRUE,
665        parse_errors  => [],
666        'exit'        => 0,
667        wait          => 0,
668        version       => 12,
669    },
670    todo_inline => {
671        results => [
672            {   is_plan       => TRUE,
673                passed        => TRUE,
674                is_ok         => TRUE,
675                raw           => '1..3',
676                tests_planned => 3,
677            },
678            {   actual_passed => FALSE,
679                is_actual_ok  => FALSE,
680                passed        => TRUE,
681                is_ok         => TRUE,
682                is_test       => TRUE,
683                has_skip      => FALSE,
684                has_todo      => TRUE,
685                number        => 1,
686                description   => "- Foo",
687                explanation   => 'Just testing the todo interface.',
688            },
689            {   actual_passed => TRUE,
690                is_actual_ok  => TRUE,
691                passed        => TRUE,
692                is_ok         => TRUE,
693                is_test       => TRUE,
694                has_skip      => FALSE,
695                has_todo      => TRUE,
696                number        => 2,
697                description   => "- Unexpected success",
698                explanation   => 'Just testing the todo interface.',
699            },
700            {   actual_passed => TRUE,
701                is_actual_ok  => TRUE,
702                passed        => TRUE,
703                is_ok         => TRUE,
704                is_test       => TRUE,
705                has_skip      => FALSE,
706                has_todo      => FALSE,
707                number        => 3,
708                description   => "- This is not todo",
709                explanation   => '',
710            },
711        ],
712        plan   => '1..3',
713        passed => [ 1, 2, 3 ],
714        actual_passed => [ 2, 3 ],
715        failed        => [],
716        actual_failed => [1],
717        todo          => [ 1, 2 ],
718        todo_passed   => [2],
719        skipped       => [],
720        good_plan     => TRUE,
721        is_good_plan  => TRUE,
722        tests_planned => 3,
723        tests_run     => 3,
724        parse_errors  => [],
725        'exit'        => 0,
726        wait          => 0,
727        version       => 12,
728    },
729    todo => {
730        results => [
731            {   is_plan       => TRUE,
732                passed        => TRUE,
733                is_ok         => TRUE,
734                raw           => '1..5 todo 3 2;',
735                tests_planned => 5,
736                todo_list     => [ 3, 2 ],
737            },
738            {   actual_passed => TRUE,
739                is_actual_ok  => TRUE,
740                passed        => TRUE,
741                is_ok         => TRUE,
742                is_test       => TRUE,
743                has_skip      => FALSE,
744                has_todo      => FALSE,
745                number        => 1,
746                description   => "",
747                explanation   => '',
748            },
749            {   actual_passed => TRUE,
750                is_actual_ok  => TRUE,
751                passed        => TRUE,
752                is_ok         => TRUE,
753                is_test       => TRUE,
754                has_skip      => FALSE,
755                has_todo      => TRUE,
756                number        => 2,
757                description   => "",
758                explanation   => '',
759            },
760            {   actual_passed => FALSE,
761                is_actual_ok  => FALSE,
762                passed        => TRUE,
763                is_ok         => TRUE,
764                is_test       => TRUE,
765                has_skip      => FALSE,
766                has_todo      => TRUE,
767                number        => 3,
768                description   => "",
769                explanation   => '',
770            },
771            {   actual_passed => TRUE,
772                is_actual_ok  => TRUE,
773                passed        => TRUE,
774                is_ok         => TRUE,
775                is_test       => TRUE,
776                has_skip      => FALSE,
777                has_todo      => FALSE,
778                number        => 4,
779                description   => "",
780                explanation   => '',
781            },
782            {   actual_passed => TRUE,
783                is_actual_ok  => TRUE,
784                passed        => TRUE,
785                is_ok         => TRUE,
786                is_test       => TRUE,
787                has_skip      => FALSE,
788                has_todo      => FALSE,
789                number        => 5,
790                description   => "",
791                explanation   => '',
792            },
793        ],
794        plan   => '1..5',
795        passed => [ 1, 2, 3, 4, 5 ],
796        actual_passed => [ 1, 2, 4, 5 ],
797        failed        => [],
798        actual_failed => [3],
799        todo          => [ 2, 3 ],
800        todo_passed   => [2],
801        skipped       => [],
802        good_plan     => TRUE,
803        is_good_plan  => TRUE,
804        tests_planned => 5,
805        tests_run     => 5,
806        parse_errors  => [],
807        'exit'        => 0,
808        wait          => 0,
809        version       => 12,
810    },
811    duplicates => {
812        results => [
813            {   is_plan       => TRUE,
814                passed        => TRUE,
815                is_ok         => TRUE,
816                raw           => '1..10',
817                tests_planned => 10,
818            },
819            {   actual_passed => TRUE,
820                is_actual_ok  => TRUE,
821                passed        => TRUE,
822                is_ok         => TRUE,
823                is_test       => TRUE,
824                has_skip      => FALSE,
825                has_todo      => FALSE,
826                number        => 1,
827                description   => '',
828                explanation   => '',
829                is_unplanned  => FALSE,
830            },
831            {   actual_passed => TRUE,
832                is_actual_ok  => TRUE,
833                passed        => TRUE,
834                is_ok         => TRUE,
835                is_test       => TRUE,
836                has_skip      => FALSE,
837                has_todo      => FALSE,
838                number        => 2,
839                description   => '',
840                explanation   => '',
841                is_unplanned  => FALSE,
842            },
843            {   actual_passed => TRUE,
844                is_actual_ok  => TRUE,
845                passed        => TRUE,
846                is_ok         => TRUE,
847                is_test       => TRUE,
848                has_skip      => FALSE,
849                has_todo      => FALSE,
850                number        => 3,
851                description   => '',
852                explanation   => '',
853                is_unplanned  => FALSE,
854            },
855            {   actual_passed => TRUE,
856                is_actual_ok  => TRUE,
857                passed        => TRUE,
858                is_ok         => TRUE,
859                is_test       => TRUE,
860                has_skip      => FALSE,
861                has_todo      => FALSE,
862                number        => 4,
863                description   => '',
864                explanation   => '',
865                is_unplanned  => FALSE,
866            },
867            {   actual_passed => TRUE,
868                is_actual_ok  => TRUE,
869                passed        => TRUE,
870                is_ok         => TRUE,
871                is_test       => TRUE,
872                has_skip      => FALSE,
873                has_todo      => FALSE,
874                number        => 4,
875                description   => '',
876                explanation   => '',
877                is_unplanned  => FALSE,
878            },
879            {   actual_passed => TRUE,
880                is_actual_ok  => TRUE,
881                passed        => TRUE,
882                is_ok         => TRUE,
883                is_test       => TRUE,
884                has_skip      => FALSE,
885                has_todo      => FALSE,
886                number        => 5,
887                description   => '',
888                explanation   => '',
889                is_unplanned  => FALSE,
890            },
891            {   actual_passed => TRUE,
892                is_actual_ok  => TRUE,
893                passed        => TRUE,
894                is_ok         => TRUE,
895                is_test       => TRUE,
896                has_skip      => FALSE,
897                has_todo      => FALSE,
898                number        => 6,
899                description   => '',
900                explanation   => '',
901                is_unplanned  => FALSE,
902            },
903            {   actual_passed => TRUE,
904                is_actual_ok  => TRUE,
905                passed        => TRUE,
906                is_ok         => TRUE,
907                is_test       => TRUE,
908                has_skip      => FALSE,
909                has_todo      => FALSE,
910                number        => 7,
911                description   => '',
912                explanation   => '',
913                is_unplanned  => FALSE,
914            },
915            {   actual_passed => TRUE,
916                is_actual_ok  => TRUE,
917                passed        => TRUE,
918                is_ok         => TRUE,
919                is_test       => TRUE,
920                has_skip      => FALSE,
921                has_todo      => FALSE,
922                number        => 8,
923                description   => '',
924                explanation   => '',
925                is_unplanned  => FALSE,
926            },
927            {   actual_passed => TRUE,
928                is_actual_ok  => TRUE,
929                passed        => TRUE,
930                is_ok         => TRUE,
931                is_test       => TRUE,
932                has_skip      => FALSE,
933                has_todo      => FALSE,
934                number        => 9,
935                description   => '',
936                explanation   => '',
937                is_unplanned  => FALSE,
938            },
939            {   actual_passed => TRUE,
940                is_actual_ok  => TRUE,
941                passed        => FALSE,
942                is_ok         => FALSE,
943                is_test       => TRUE,
944                has_skip      => FALSE,
945                has_todo      => FALSE,
946                number        => 10,
947                description   => '',
948                explanation   => '',
949                is_unplanned  => TRUE,
950            },
951        ],
952        plan          => '1..10',
953        passed        => [ 1 .. 4, 4 .. 9 ],
954        actual_passed => [ 1 .. 4, 4 .. 10 ],
955        failed        => [10],
956        actual_failed => [],
957        todo          => [],
958        todo_passed   => [],
959        skipped       => [],
960        good_plan     => FALSE,
961        tests_planned => 10,
962        tests_run     => 11,
963        parse_errors  => [
964            'Tests out of sequence.  Found (4) but expected (5)',
965            'Tests out of sequence.  Found (5) but expected (6)',
966            'Tests out of sequence.  Found (6) but expected (7)',
967            'Tests out of sequence.  Found (7) but expected (8)',
968            'Tests out of sequence.  Found (8) but expected (9)',
969            'Tests out of sequence.  Found (9) but expected (10)',
970            'Tests out of sequence.  Found (10) but expected (11)',
971            'Bad plan.  You planned 10 tests but ran 11.',
972        ],
973        'exit' => 0,
974        wait   => 0,
975    },
976    no_nums => {
977        results => [
978            {   is_plan       => TRUE,
979                passed        => TRUE,
980                is_ok         => TRUE,
981                raw           => '1..5',
982                tests_planned => 5,
983            },
984            {   actual_passed => TRUE,
985                is_actual_ok  => TRUE,
986                description   => "",
987                passed        => TRUE,
988                is_ok         => TRUE,
989                is_test       => TRUE,
990                has_skip      => FALSE,
991                has_todo      => FALSE,
992                number        => 1,
993            },
994            {   actual_passed => TRUE,
995                is_actual_ok  => TRUE,
996                passed        => TRUE,
997                is_ok         => TRUE,
998                is_test       => TRUE,
999                has_skip      => FALSE,
1000                has_todo      => FALSE,
1001                number        => 2,
1002                description   => "",
1003            },
1004            {   actual_passed => FALSE,
1005                is_actual_ok  => FALSE,
1006                passed        => FALSE,
1007                is_ok         => FALSE,
1008                is_test       => TRUE,
1009                has_skip      => FALSE,
1010                has_todo      => FALSE,
1011                number        => 3,
1012                description   => "",
1013            },
1014            {   actual_passed => TRUE,
1015                is_actual_ok  => TRUE,
1016                passed        => TRUE,
1017                is_ok         => TRUE,
1018                is_test       => TRUE,
1019                has_skip      => FALSE,
1020                has_todo      => FALSE,
1021                number        => 4,
1022                description   => "",
1023            },
1024            {   actual_passed => TRUE,
1025                is_actual_ok  => TRUE,
1026                passed        => TRUE,
1027                is_ok         => TRUE,
1028                is_test       => TRUE,
1029                has_skip      => FALSE,
1030                has_todo      => FALSE,
1031                number        => 5,
1032                description   => "",
1033            }
1034        ],
1035        plan          => '1..5',
1036        passed        => [ 1, 2, 4, 5 ],
1037        actual_passed => [ 1, 2, 4, 5 ],
1038        failed        => [3],
1039        actual_failed => [3],
1040        todo          => [],
1041        todo_passed   => [],
1042        skipped       => [],
1043        good_plan     => TRUE,
1044        is_good_plan  => TRUE,
1045        tests_planned => 5,
1046        tests_run     => 5,
1047        parse_errors  => [],
1048        'exit'        => 0,
1049        wait          => 0,
1050        version       => 12,
1051    },
1052    bailout => {
1053        results => [
1054            {   is_plan       => TRUE,
1055                passed        => TRUE,
1056                is_ok         => TRUE,
1057                raw           => '1..5',
1058                tests_planned => 5,
1059            },
1060            {   actual_passed => TRUE,
1061                is_actual_ok  => TRUE,
1062                description   => "",
1063                passed        => TRUE,
1064                is_ok         => TRUE,
1065                is_test       => TRUE,
1066                has_skip      => FALSE,
1067                has_todo      => FALSE,
1068                number        => 1,
1069            },
1070            {   actual_passed => TRUE,
1071                is_actual_ok  => TRUE,
1072                passed        => TRUE,
1073                is_ok         => TRUE,
1074                is_test       => TRUE,
1075                has_skip      => FALSE,
1076                has_todo      => FALSE,
1077                number        => 2,
1078                description   => "",
1079            },
1080            {   actual_passed => TRUE,
1081                is_actual_ok  => TRUE,
1082                passed        => TRUE,
1083                is_ok         => TRUE,
1084                is_test       => TRUE,
1085                has_skip      => FALSE,
1086                has_todo      => FALSE,
1087                number        => 3,
1088                description   => "",
1089            },
1090            {   is_bailout  => TRUE,
1091                explanation => "GERONIMMMOOOOOO!!!",
1092            },
1093            {   actual_passed => TRUE,
1094                is_actual_ok  => TRUE,
1095                passed        => TRUE,
1096                is_ok         => TRUE,
1097                is_test       => TRUE,
1098                has_skip      => FALSE,
1099                has_todo      => FALSE,
1100                number        => 4,
1101                description   => "",
1102            },
1103            {   actual_passed => TRUE,
1104                is_actual_ok  => TRUE,
1105                passed        => TRUE,
1106                is_ok         => TRUE,
1107                is_test       => TRUE,
1108                has_skip      => FALSE,
1109                has_todo      => FALSE,
1110                number        => 5,
1111                description   => "",
1112            }
1113        ],
1114        plan          => '1..5',
1115        passed        => [ 1 .. 5 ],
1116        actual_passed => [ 1 .. 5 ],
1117        failed        => [],
1118        actual_failed => [],
1119        todo          => [],
1120        todo_passed   => [],
1121        skipped       => [],
1122        good_plan     => TRUE,
1123        is_good_plan  => TRUE,
1124        tests_planned => 5,
1125        tests_run     => 5,
1126        parse_errors  => [],
1127        'exit'        => 0,
1128        wait          => 0,
1129        version       => 12,
1130    },
1131    no_output => {
1132        results       => [],
1133        plan          => '',
1134        passed        => [],
1135        actual_passed => [],
1136        failed        => [],
1137        actual_failed => [],
1138        todo          => [],
1139        todo_passed   => [],
1140        skipped       => [],
1141        good_plan     => FALSE,
1142        tests_planned => undef,
1143        tests_run     => 0,
1144        parse_errors  => [ 'No plan found in TAP output', ],
1145        'exit'        => 0,
1146        wait          => 0,
1147    },
1148    too_many => {
1149        results => [
1150            {   is_plan       => TRUE,
1151                passed        => TRUE,
1152                is_ok         => TRUE,
1153                raw           => '1..3',
1154                tests_planned => 3,
1155            },
1156            {   actual_passed => TRUE,
1157                is_actual_ok  => TRUE,
1158                description   => "",
1159                passed        => TRUE,
1160                is_ok         => TRUE,
1161                is_test       => TRUE,
1162                has_skip      => FALSE,
1163                has_todo      => FALSE,
1164                number        => 1,
1165                is_unplanned  => FALSE,
1166            },
1167            {   actual_passed => TRUE,
1168                is_actual_ok  => TRUE,
1169                passed        => TRUE,
1170                is_ok         => TRUE,
1171                is_test       => TRUE,
1172                has_skip      => FALSE,
1173                has_todo      => FALSE,
1174                number        => 2,
1175                description   => "",
1176                is_unplanned  => FALSE,
1177            },
1178            {   actual_passed => TRUE,
1179                is_actual_ok  => TRUE,
1180                passed        => TRUE,
1181                is_ok         => TRUE,
1182                is_test       => TRUE,
1183                has_skip      => FALSE,
1184                has_todo      => FALSE,
1185                number        => 3,
1186                description   => "",
1187                is_unplanned  => FALSE,
1188            },
1189            {   actual_passed => TRUE,
1190                is_actual_ok  => TRUE,
1191                passed        => FALSE,
1192                is_ok         => FALSE,
1193                is_test       => TRUE,
1194                has_skip      => FALSE,
1195                has_todo      => FALSE,
1196                number        => 4,
1197                description   => "",
1198                is_unplanned  => TRUE,
1199            },
1200            {   actual_passed => TRUE,
1201                is_actual_ok  => TRUE,
1202                passed        => FALSE,
1203                is_ok         => FALSE,
1204                is_test       => TRUE,
1205                has_skip      => FALSE,
1206                has_todo      => FALSE,
1207                number        => 5,
1208                description   => "",
1209                is_unplanned  => TRUE,
1210            },
1211            {   actual_passed => TRUE,
1212                is_actual_ok  => TRUE,
1213                passed        => FALSE,
1214                is_ok         => FALSE,
1215                is_test       => TRUE,
1216                has_skip      => FALSE,
1217                has_todo      => FALSE,
1218                number        => 6,
1219                description   => "",
1220                is_unplanned  => TRUE,
1221            },
1222            {   actual_passed => TRUE,
1223                is_actual_ok  => TRUE,
1224                passed        => FALSE,
1225                is_ok         => FALSE,
1226                is_test       => TRUE,
1227                has_skip      => FALSE,
1228                has_todo      => FALSE,
1229                number        => 7,
1230                description   => "",
1231                is_unplanned  => TRUE,
1232            },
1233        ],
1234        plan          => '1..3',
1235        passed        => [ 1 .. 3 ],
1236        actual_passed => [ 1 .. 7 ],
1237        failed        => [ 4 .. 7 ],
1238        actual_failed => [],
1239        todo          => [],
1240        todo_passed   => [],
1241        skipped       => [],
1242        good_plan     => FALSE,
1243        tests_planned => 3,
1244        tests_run     => 7,
1245        parse_errors  => ['Bad plan.  You planned 3 tests but ran 7.'],
1246        'exit'        => 4,
1247        wait          => NOT_ZERO,
1248        skip_if       => sub {$IsVMS},
1249    },
1250    taint => {
1251        results => [
1252            {   is_plan       => TRUE,
1253                passed        => TRUE,
1254                is_ok         => TRUE,
1255                raw           => '1..1',
1256                tests_planned => TRUE,
1257            },
1258            {   actual_passed => TRUE,
1259                is_actual_ok  => TRUE,
1260                description   => "- -T honored",
1261                passed        => TRUE,
1262                is_ok         => TRUE,
1263                is_test       => TRUE,
1264                has_skip      => FALSE,
1265                has_todo      => FALSE,
1266                number        => 1,
1267            },
1268        ],
1269        plan          => '1..1',
1270        passed        => [ 1 .. 1 ],
1271        actual_passed => [ 1 .. 1 ],
1272        failed        => [],
1273        actual_failed => [],
1274        todo          => [],
1275        todo_passed   => [],
1276        skipped       => [],
1277        good_plan     => TRUE,
1278        is_good_plan  => TRUE,
1279        tests_planned => TRUE,
1280        tests_run     => TRUE,
1281        parse_errors  => [],
1282        'exit'        => 0,
1283        wait          => 0,
1284        version       => 12,
1285    },
1286    'die' => {
1287        results       => [],
1288        plan          => '',
1289        passed        => [],
1290        actual_passed => [],
1291        failed        => [],
1292        actual_failed => [],
1293        todo          => [],
1294        todo_passed   => [],
1295        skipped       => [],
1296        good_plan     => FALSE,
1297        tests_planned => undef,
1298        tests_run     => 0,
1299        parse_errors  => [ 'No plan found in TAP output', ],
1300        'exit'        => NOT_ZERO,
1301        wait          => NOT_ZERO,
1302    },
1303    die_head_end => {
1304        results => [
1305            {   actual_passed => TRUE,
1306                is_actual_ok  => TRUE,
1307                passed        => TRUE,
1308                is_ok         => TRUE,
1309                is_test       => TRUE,
1310                has_skip      => FALSE,
1311                has_todo      => FALSE,
1312                number        => 1,
1313                description   => '',
1314                explanation   => '',
1315            },
1316            {   actual_passed => TRUE,
1317                is_actual_ok  => TRUE,
1318                passed        => TRUE,
1319                is_ok         => TRUE,
1320                is_test       => TRUE,
1321                has_skip      => FALSE,
1322                has_todo      => FALSE,
1323                number        => 2,
1324                description   => '',
1325                explanation   => '',
1326            },
1327            {   actual_passed => TRUE,
1328                is_actual_ok  => TRUE,
1329                passed        => TRUE,
1330                is_ok         => TRUE,
1331                is_test       => TRUE,
1332                has_skip      => FALSE,
1333                has_todo      => FALSE,
1334                number        => 3,
1335                description   => '',
1336                explanation   => '',
1337            },
1338            {   actual_passed => TRUE,
1339                is_actual_ok  => TRUE,
1340                passed        => TRUE,
1341                is_ok         => TRUE,
1342                is_test       => TRUE,
1343                has_skip      => FALSE,
1344                has_todo      => FALSE,
1345                number        => 4,
1346                description   => '',
1347                explanation   => '',
1348            },
1349        ],
1350        plan          => '',
1351        passed        => [ 1 .. 4 ],
1352        actual_passed => [ 1 .. 4 ],
1353        failed        => [],
1354        actual_failed => [],
1355        todo          => [],
1356        todo_passed   => [],
1357        skipped       => [],
1358        good_plan     => FALSE,
1359        tests_planned => undef,
1360        tests_run     => 4,
1361        parse_errors  => [ 'No plan found in TAP output', ],
1362        'exit'        => NOT_ZERO,
1363        wait          => NOT_ZERO,
1364    },
1365    die_last_minute => {
1366        results => [
1367            {   actual_passed => TRUE,
1368                is_actual_ok  => TRUE,
1369                passed        => TRUE,
1370                is_ok         => TRUE,
1371                is_test       => TRUE,
1372                has_skip      => FALSE,
1373                has_todo      => FALSE,
1374                number        => 1,
1375                description   => '',
1376                explanation   => '',
1377            },
1378            {   actual_passed => TRUE,
1379                is_actual_ok  => TRUE,
1380                passed        => TRUE,
1381                is_ok         => TRUE,
1382                is_test       => TRUE,
1383                has_skip      => FALSE,
1384                has_todo      => FALSE,
1385                number        => 2,
1386                description   => '',
1387                explanation   => '',
1388            },
1389            {   actual_passed => TRUE,
1390                is_actual_ok  => TRUE,
1391                passed        => TRUE,
1392                is_ok         => TRUE,
1393                is_test       => TRUE,
1394                has_skip      => FALSE,
1395                has_todo      => FALSE,
1396                number        => 3,
1397                description   => '',
1398                explanation   => '',
1399            },
1400            {   actual_passed => TRUE,
1401                is_actual_ok  => TRUE,
1402                passed        => TRUE,
1403                is_ok         => TRUE,
1404                is_test       => TRUE,
1405                has_skip      => FALSE,
1406                has_todo      => FALSE,
1407                number        => 4,
1408                description   => '',
1409                explanation   => '',
1410            },
1411            {   is_plan       => TRUE,
1412                passed        => TRUE,
1413                is_ok         => TRUE,
1414                raw           => '1..4',
1415                tests_planned => 4,
1416            },
1417        ],
1418        plan          => '1..4',
1419        passed        => [ 1 .. 4 ],
1420        actual_passed => [ 1 .. 4 ],
1421        failed        => [],
1422        actual_failed => [],
1423        todo          => [],
1424        todo_passed   => [],
1425        skipped       => [],
1426        good_plan     => TRUE,
1427        is_good_plan  => TRUE,
1428        tests_planned => 4,
1429        tests_run     => 4,
1430        parse_errors  => [],
1431        'exit'        => NOT_ZERO,
1432        wait          => NOT_ZERO,
1433    },
1434    bignum => {
1435        results => [
1436            {   is_plan       => TRUE,
1437                passed        => TRUE,
1438                is_ok         => TRUE,
1439                raw           => '1..2',
1440                tests_planned => 2,
1441            },
1442            {   actual_passed => TRUE,
1443                is_actual_ok  => TRUE,
1444                passed        => TRUE,
1445                is_ok         => TRUE,
1446                is_test       => TRUE,
1447                has_skip      => FALSE,
1448                has_todo      => FALSE,
1449                number        => 1,
1450                description   => '',
1451                explanation   => '',
1452            },
1453            {   actual_passed => TRUE,
1454                is_actual_ok  => TRUE,
1455                passed        => TRUE,
1456                is_ok         => TRUE,
1457                is_test       => TRUE,
1458                has_skip      => FALSE,
1459                has_todo      => FALSE,
1460                number        => 2,
1461                description   => '',
1462                explanation   => '',
1463            },
1464            {   actual_passed => TRUE,
1465                is_actual_ok  => TRUE,
1466                passed        => FALSE,
1467                is_ok         => FALSE,
1468                is_test       => TRUE,
1469                has_skip      => FALSE,
1470                has_todo      => FALSE,
1471                number        => 136211425,
1472                description   => '',
1473                explanation   => '',
1474            },
1475            {   actual_passed => TRUE,
1476                is_actual_ok  => TRUE,
1477                passed        => FALSE,
1478                is_ok         => FALSE,
1479                is_test       => TRUE,
1480                has_skip      => FALSE,
1481                has_todo      => FALSE,
1482                number        => 136211426,
1483                description   => '',
1484                explanation   => '',
1485            },
1486        ],
1487        plan          => '1..2',
1488        passed        => [ 1, 2 ],
1489        actual_passed => [ 1, 2, 136211425, 136211426 ],
1490        failed        => [ 136211425, 136211426 ],
1491        actual_failed => [],
1492        todo          => [],
1493        todo_passed   => [],
1494        skipped       => [],
1495        good_plan     => FALSE,
1496        tests_planned => 2,
1497        tests_run     => 4,
1498        parse_errors  => [
1499            'Tests out of sequence.  Found (136211425) but expected (3)',
1500            'Tests out of sequence.  Found (136211426) but expected (4)',
1501            'Bad plan.  You planned 2 tests but ran 4.'
1502        ],
1503        'exit' => 0,
1504        wait   => 0,
1505    },
1506    bignum_many => {
1507        results => [
1508            {   is_plan       => TRUE,
1509                passed        => TRUE,
1510                is_ok         => TRUE,
1511                raw           => '1..2',
1512                tests_planned => 2,
1513            },
1514            {   actual_passed => TRUE,
1515                is_actual_ok  => TRUE,
1516                passed        => TRUE,
1517                is_ok         => TRUE,
1518                is_test       => TRUE,
1519                has_skip      => FALSE,
1520                has_todo      => FALSE,
1521                number        => 1,
1522                description   => '',
1523                explanation   => '',
1524            },
1525            {   actual_passed => TRUE,
1526                is_actual_ok  => TRUE,
1527                passed        => TRUE,
1528                is_ok         => TRUE,
1529                is_test       => TRUE,
1530                has_skip      => FALSE,
1531                has_todo      => FALSE,
1532                number        => 2,
1533                description   => '',
1534                explanation   => '',
1535            },
1536            {   actual_passed => TRUE,
1537                is_actual_ok  => TRUE,
1538                passed        => FALSE,
1539                is_ok         => FALSE,
1540                is_test       => TRUE,
1541                has_skip      => FALSE,
1542                has_todo      => FALSE,
1543                number        => 99997,
1544                description   => '',
1545                explanation   => '',
1546            },
1547            {   actual_passed => TRUE,
1548                is_actual_ok  => TRUE,
1549                passed        => FALSE,
1550                is_ok         => FALSE,
1551                is_test       => TRUE,
1552                has_skip      => FALSE,
1553                has_todo      => FALSE,
1554                number        => 99998,
1555                description   => '',
1556                explanation   => '',
1557            },
1558            {   actual_passed => TRUE,
1559                is_actual_ok  => TRUE,
1560                passed        => FALSE,
1561                is_ok         => FALSE,
1562                is_test       => TRUE,
1563                has_skip      => FALSE,
1564                has_todo      => FALSE,
1565                number        => 99999,
1566                description   => '',
1567                explanation   => '',
1568            },
1569            {   actual_passed => TRUE,
1570                is_actual_ok  => TRUE,
1571                passed        => FALSE,
1572                is_ok         => FALSE,
1573                is_test       => TRUE,
1574                has_skip      => FALSE,
1575                has_todo      => FALSE,
1576                number        => 100000,
1577                description   => '',
1578                explanation   => '',
1579            },
1580            {   actual_passed => TRUE,
1581                is_actual_ok  => TRUE,
1582                passed        => FALSE,
1583                is_ok         => FALSE,
1584                is_test       => TRUE,
1585                has_skip      => FALSE,
1586                has_todo      => FALSE,
1587                number        => 100001,
1588                description   => '',
1589                explanation   => '',
1590            },
1591            {   actual_passed => TRUE,
1592                is_actual_ok  => TRUE,
1593                passed        => FALSE,
1594                is_ok         => FALSE,
1595                is_test       => TRUE,
1596                has_skip      => FALSE,
1597                has_todo      => FALSE,
1598                number        => 100002,
1599                description   => '',
1600                explanation   => '',
1601            },
1602            {   actual_passed => TRUE,
1603                is_actual_ok  => TRUE,
1604                passed        => FALSE,
1605                is_ok         => FALSE,
1606                is_test       => TRUE,
1607                has_skip      => FALSE,
1608                has_todo      => FALSE,
1609                number        => 100003,
1610                description   => '',
1611                explanation   => '',
1612            },
1613            {   actual_passed => TRUE,
1614                is_actual_ok  => TRUE,
1615                passed        => FALSE,
1616                is_ok         => FALSE,
1617                is_test       => TRUE,
1618                has_skip      => FALSE,
1619                has_todo      => FALSE,
1620                number        => 100004,
1621                description   => '',
1622                explanation   => '',
1623            },
1624            {   actual_passed => TRUE,
1625                is_actual_ok  => TRUE,
1626                passed        => FALSE,
1627                is_ok         => FALSE,
1628                is_test       => TRUE,
1629                has_skip      => FALSE,
1630                has_todo      => FALSE,
1631                number        => 100005,
1632                description   => '',
1633                explanation   => '',
1634            },
1635        ],
1636        plan          => '1..2',
1637        passed        => [ 1, 2 ],
1638        actual_passed => [ 1, 2, 99997 .. 100005 ],
1639        failed        => [ 99997 .. 100005 ],
1640        actual_failed => [],
1641        todo          => [],
1642        todo_passed   => [],
1643        skipped       => [],
1644        good_plan     => FALSE,
1645        tests_planned => 2,
1646        tests_run     => 11,
1647        parse_errors  => [
1648            'Tests out of sequence.  Found (99997) but expected (3)',
1649            'Tests out of sequence.  Found (99998) but expected (4)',
1650            'Tests out of sequence.  Found (99999) but expected (5)',
1651            'Tests out of sequence.  Found (100000) but expected (6)',
1652            'Tests out of sequence.  Found (100001) but expected (7)',
1653            'Tests out of sequence.  Found (100002) but expected (8)',
1654            'Tests out of sequence.  Found (100003) but expected (9)',
1655            'Tests out of sequence.  Found (100004) but expected (10)',
1656            'Tests out of sequence.  Found (100005) but expected (11)',
1657            'Bad plan.  You planned 2 tests but ran 11.'
1658        ],
1659        'exit' => 0,
1660        wait   => 0,
1661    },
1662    combined => {
1663        results => [
1664            {   is_plan       => TRUE,
1665                passed        => TRUE,
1666                is_ok         => TRUE,
1667                raw           => '1..10',
1668                tests_planned => 10,
1669            },
1670            {   actual_passed => TRUE,
1671                is_actual_ok  => TRUE,
1672                passed        => TRUE,
1673                is_ok         => TRUE,
1674                is_test       => TRUE,
1675                has_skip      => FALSE,
1676                has_todo      => FALSE,
1677                number        => 1,
1678                description   => '',
1679                explanation   => '',
1680            },
1681            {   actual_passed => TRUE,
1682                is_actual_ok  => TRUE,
1683                passed        => TRUE,
1684                is_ok         => TRUE,
1685                is_test       => TRUE,
1686                has_skip      => FALSE,
1687                has_todo      => FALSE,
1688                number        => 2,
1689                description   => 'basset hounds got long ears',
1690                explanation   => '',
1691            },
1692            {   actual_passed => FALSE,
1693                is_actual_ok  => FALSE,
1694                passed        => FALSE,
1695                is_ok         => FALSE,
1696                is_test       => TRUE,
1697                has_skip      => FALSE,
1698                has_todo      => FALSE,
1699                number        => 3,
1700                description   => 'all hell broke loose',
1701                explanation   => '',
1702            },
1703            {   actual_passed => FALSE,
1704                is_actual_ok  => FALSE,
1705                passed        => TRUE,
1706                is_ok         => TRUE,
1707                is_test       => TRUE,
1708                has_skip      => FALSE,
1709                has_todo      => TRUE,
1710                number        => 4,
1711                description   => '',
1712                explanation   => 'if I heard a voice from heaven ...',
1713            },
1714            {   actual_passed => TRUE,
1715                is_actual_ok  => TRUE,
1716                passed        => TRUE,
1717                is_ok         => TRUE,
1718                is_test       => TRUE,
1719                has_skip      => FALSE,
1720                has_todo      => FALSE,
1721                number        => 5,
1722                description   => 'say "live without loving",',
1723                explanation   => '',
1724            },
1725            {   actual_passed => TRUE,
1726                is_actual_ok  => TRUE,
1727                passed        => TRUE,
1728                is_ok         => TRUE,
1729                is_test       => TRUE,
1730                has_skip      => FALSE,
1731                has_todo      => FALSE,
1732                number        => 6,
1733                description   => "I'd beg off.",
1734                explanation   => '',
1735            },
1736            {   actual_passed => TRUE,
1737                is_actual_ok  => TRUE,
1738                passed        => TRUE,
1739                is_ok         => TRUE,
1740                is_test       => TRUE,
1741                has_skip      => '1',
1742                has_todo      => FALSE,
1743                number        => 7,
1744                description   => '',
1745                explanation   => 'contract negotiations',
1746            },
1747            {   actual_passed => TRUE,
1748                is_actual_ok  => TRUE,
1749                passed        => TRUE,
1750                is_ok         => TRUE,
1751                is_test       => TRUE,
1752                has_skip      => FALSE,
1753                has_todo      => FALSE,
1754                number        => 8,
1755                description   => 'Girls are such exquisite hell',
1756                explanation   => '',
1757            },
1758            {   actual_passed => TRUE,
1759                is_actual_ok  => TRUE,
1760                passed        => TRUE,
1761                is_ok         => TRUE,
1762                is_test       => TRUE,
1763                has_skip      => FALSE,
1764                has_todo      => TRUE,
1765                number        => 9,
1766                description   => 'Elegy 9B',
1767                explanation   => '',
1768            },
1769            {   actual_passed => FALSE,
1770                is_actual_ok  => FALSE,
1771                passed        => FALSE,
1772                is_ok         => FALSE,
1773                is_test       => TRUE,
1774                has_skip      => FALSE,
1775                has_todo      => FALSE,
1776                number        => 10,
1777                description   => '',
1778                explanation   => '',
1779            },
1780        ],
1781        plan          => '1..10',
1782        passed        => [ 1 .. 2, 4 .. 9 ],
1783        actual_passed => [ 1 .. 2, 5 .. 9 ],
1784        failed        => [ 3, 10 ],
1785        actual_failed => [ 3, 4, 10 ],
1786        todo          => [ 4, 9 ],
1787        todo_passed   => [9],
1788        skipped       => [7],
1789        good_plan     => TRUE,
1790        is_good_plan  => TRUE,
1791        tests_planned => 10,
1792        tests_run     => 10,
1793        parse_errors  => [],
1794        'exit'        => 0,
1795        wait          => 0,
1796        version       => 12,
1797    },
1798    head_end => {
1799        results => [
1800            {   is_comment => TRUE,
1801                passed     => TRUE,
1802                is_ok      => TRUE,
1803                comment    => 'comments',
1804            },
1805            {   actual_passed => TRUE,
1806                is_actual_ok  => TRUE,
1807                passed        => TRUE,
1808                is_ok         => TRUE,
1809                is_test       => TRUE,
1810                has_skip      => FALSE,
1811                has_todo      => FALSE,
1812                number        => 1,
1813                description   => '',
1814                explanation   => '',
1815            },
1816            {   actual_passed => TRUE,
1817                is_actual_ok  => TRUE,
1818                passed        => TRUE,
1819                is_ok         => TRUE,
1820                is_test       => TRUE,
1821                has_skip      => FALSE,
1822                has_todo      => FALSE,
1823                number        => 2,
1824                description   => '',
1825                explanation   => '',
1826            },
1827            {   actual_passed => TRUE,
1828                is_actual_ok  => TRUE,
1829                passed        => TRUE,
1830                is_ok         => TRUE,
1831                is_test       => TRUE,
1832                has_skip      => FALSE,
1833                has_todo      => FALSE,
1834                number        => 3,
1835                description   => '',
1836                explanation   => '',
1837            },
1838            {   actual_passed => TRUE,
1839                is_actual_ok  => TRUE,
1840                passed        => TRUE,
1841                is_ok         => TRUE,
1842                is_test       => TRUE,
1843                has_skip      => FALSE,
1844                has_todo      => FALSE,
1845                number        => 4,
1846                description   => '',
1847                explanation   => '',
1848            },
1849            {   is_comment => TRUE,
1850                passed     => TRUE,
1851                is_ok      => TRUE,
1852                comment    => 'comment',
1853            },
1854            {   is_plan       => TRUE,
1855                passed        => TRUE,
1856                is_ok         => TRUE,
1857                raw           => '1..4',
1858                tests_planned => 4,
1859            },
1860            {   is_comment => TRUE,
1861                passed     => TRUE,
1862                is_ok      => TRUE,
1863                comment    => 'more ignored stuff',
1864            },
1865            {   is_comment => TRUE,
1866                passed     => TRUE,
1867                is_ok      => TRUE,
1868                comment    => 'and yet more',
1869            },
1870        ],
1871        plan          => '1..4',
1872        passed        => [ 1 .. 4 ],
1873        actual_passed => [ 1 .. 4 ],
1874        failed        => [],
1875        actual_failed => [],
1876        todo          => [],
1877        todo_passed   => [],
1878        skipped       => [],
1879        good_plan     => TRUE,
1880        is_good_plan  => TRUE,
1881        tests_planned => 4,
1882        tests_run     => 4,
1883        parse_errors  => [],
1884        'exit'        => 0,
1885        wait          => 0,
1886        version       => 12,
1887    },
1888    head_fail => {
1889        results => [
1890            {   is_comment => TRUE,
1891                passed     => TRUE,
1892                is_ok      => TRUE,
1893                comment    => 'comments',
1894            },
1895            {   actual_passed => TRUE,
1896                is_actual_ok  => TRUE,
1897                passed        => TRUE,
1898                is_ok         => TRUE,
1899                is_test       => TRUE,
1900                has_skip      => FALSE,
1901                has_todo      => FALSE,
1902                number        => 1,
1903                description   => '',
1904                explanation   => '',
1905            },
1906            {   actual_passed => FALSE,
1907                is_actual_ok  => FALSE,
1908                passed        => FALSE,
1909                is_ok         => FALSE,
1910                is_test       => TRUE,
1911                has_skip      => FALSE,
1912                has_todo      => FALSE,
1913                number        => 2,
1914                description   => '',
1915                explanation   => '',
1916            },
1917            {   actual_passed => TRUE,
1918                is_actual_ok  => TRUE,
1919                passed        => TRUE,
1920                is_ok         => TRUE,
1921                is_test       => TRUE,
1922                has_skip      => FALSE,
1923                has_todo      => FALSE,
1924                number        => 3,
1925                description   => '',
1926                explanation   => '',
1927            },
1928            {   actual_passed => TRUE,
1929                is_actual_ok  => TRUE,
1930                passed        => TRUE,
1931                is_ok         => TRUE,
1932                is_test       => TRUE,
1933                has_skip      => FALSE,
1934                has_todo      => FALSE,
1935                number        => 4,
1936                description   => '',
1937                explanation   => '',
1938            },
1939            {   is_comment => TRUE,
1940                passed     => TRUE,
1941                is_ok      => TRUE,
1942                comment    => 'comment',
1943            },
1944            {   is_plan       => TRUE,
1945                passed        => TRUE,
1946                is_ok         => TRUE,
1947                raw           => '1..4',
1948                tests_planned => 4,
1949            },
1950            {   is_comment => TRUE,
1951                passed     => TRUE,
1952                is_ok      => TRUE,
1953                comment    => 'more ignored stuff',
1954            },
1955            {   is_comment => TRUE,
1956                passed     => TRUE,
1957                is_ok      => TRUE,
1958                comment    => 'and yet more',
1959            },
1960        ],
1961        plan          => '1..4',
1962        passed        => [ 1, 3, 4 ],
1963        actual_passed => [ 1, 3, 4 ],
1964        failed        => [2],
1965        actual_failed => [2],
1966        todo          => [],
1967        todo_passed   => [],
1968        skipped       => [],
1969        good_plan     => TRUE,
1970        is_good_plan  => TRUE,
1971        tests_planned => 4,
1972        tests_run     => 4,
1973        parse_errors  => [],
1974        'exit'        => 0,
1975        wait          => 0,
1976        version       => 12,
1977    },
1978    out_of_order => {
1979        results => [
1980            {   actual_passed => TRUE,
1981                is_actual_ok  => TRUE,
1982                passed        => TRUE,
1983                is_ok         => TRUE,
1984                is_test       => TRUE,
1985                has_skip      => FALSE,
1986                has_todo      => FALSE,
1987                number        => 2,
1988                description   => '- Test that argument passing works',
1989                explanation   => '',
1990            },
1991            {   actual_passed => TRUE,
1992                is_actual_ok  => TRUE,
1993                passed        => TRUE,
1994                is_ok         => TRUE,
1995                is_test       => TRUE,
1996                has_skip      => FALSE,
1997                has_todo      => FALSE,
1998                number        => 3,
1999                description =>
2000                  '- Test that passing arguments as references work',
2001                explanation => '',
2002            },
2003            {   actual_passed => TRUE,
2004                is_actual_ok  => TRUE,
2005                passed        => TRUE,
2006                is_ok         => TRUE,
2007                is_test       => TRUE,
2008                has_skip      => FALSE,
2009                has_todo      => FALSE,
2010                number        => 4,
2011                description   => '- Test a normal sub',
2012                explanation   => '',
2013            },
2014            {   actual_passed => TRUE,
2015                is_actual_ok  => TRUE,
2016                passed        => TRUE,
2017                is_ok         => TRUE,
2018                is_test       => TRUE,
2019                has_skip      => FALSE,
2020                has_todo      => FALSE,
2021                number        => 6,
2022                description   => '- Detach test',
2023                explanation   => '',
2024            },
2025            {   actual_passed => TRUE,
2026                is_actual_ok  => TRUE,
2027                passed        => TRUE,
2028                is_ok         => TRUE,
2029                is_test       => TRUE,
2030                has_skip      => FALSE,
2031                has_todo      => FALSE,
2032                number        => 8,
2033                description   => '- Nested thread test',
2034                explanation   => '',
2035            },
2036            {   actual_passed => TRUE,
2037                is_actual_ok  => TRUE,
2038                passed        => TRUE,
2039                is_ok         => TRUE,
2040                is_test       => TRUE,
2041                has_skip      => FALSE,
2042                has_todo      => FALSE,
2043                number        => 9,
2044                description   => '- Nested thread test',
2045                explanation   => '',
2046            },
2047            {   actual_passed => TRUE,
2048                is_actual_ok  => TRUE,
2049                passed        => TRUE,
2050                is_ok         => TRUE,
2051                is_test       => TRUE,
2052                has_skip      => FALSE,
2053                has_todo      => FALSE,
2054                number        => 10,
2055                description   => '- Wanted 7, got 7',
2056                explanation   => '',
2057            },
2058            {   actual_passed => TRUE,
2059                is_actual_ok  => TRUE,
2060                passed        => TRUE,
2061                is_ok         => TRUE,
2062                is_test       => TRUE,
2063                has_skip      => FALSE,
2064                has_todo      => FALSE,
2065                number        => 11,
2066                description   => '- Wanted 7, got 7',
2067                explanation   => '',
2068            },
2069            {   actual_passed => TRUE,
2070                is_actual_ok  => TRUE,
2071                passed        => TRUE,
2072                is_ok         => TRUE,
2073                is_test       => TRUE,
2074                has_skip      => FALSE,
2075                has_todo      => FALSE,
2076                number        => 12,
2077                description   => '- Wanted 8, got 8',
2078                explanation   => '',
2079            },
2080            {   actual_passed => TRUE,
2081                is_actual_ok  => TRUE,
2082                passed        => TRUE,
2083                is_ok         => TRUE,
2084                is_test       => TRUE,
2085                has_skip      => FALSE,
2086                has_todo      => FALSE,
2087                number        => 13,
2088                description   => '- Wanted 8, got 8',
2089                explanation   => '',
2090            },
2091            {   is_plan       => TRUE,
2092                passed        => TRUE,
2093                is_ok         => TRUE,
2094                raw           => '1..15',
2095                tests_planned => 15,
2096            },
2097            {   actual_passed => TRUE,
2098                is_actual_ok  => TRUE,
2099                passed        => TRUE,
2100                is_ok         => TRUE,
2101                is_test       => TRUE,
2102                has_skip      => FALSE,
2103                has_todo      => FALSE,
2104                number        => 1,
2105                description   => '',
2106                explanation   => '',
2107            },
2108            {   actual_passed => TRUE,
2109                is_actual_ok  => TRUE,
2110                passed        => TRUE,
2111                is_ok         => TRUE,
2112                is_test       => TRUE,
2113                has_skip      => FALSE,
2114                has_todo      => FALSE,
2115                number        => 5,
2116                description   => '- Check that Config::threads is true',
2117                explanation   => '',
2118            },
2119            {   actual_passed => TRUE,
2120                is_actual_ok  => TRUE,
2121                passed        => TRUE,
2122                is_ok         => TRUE,
2123                is_test       => TRUE,
2124                has_skip      => FALSE,
2125                has_todo      => FALSE,
2126                number        => 7,
2127                description   => '- Detach test',
2128                explanation   => '',
2129            },
2130            {   actual_passed => TRUE,
2131                is_actual_ok  => TRUE,
2132                passed        => TRUE,
2133                is_ok         => TRUE,
2134                is_test       => TRUE,
2135                has_skip      => FALSE,
2136                has_todo      => FALSE,
2137                number        => 14,
2138                description =>
2139                  '- Check so that tid for threads work for main thread',
2140                explanation => '',
2141            },
2142            {   actual_passed => TRUE,
2143                is_actual_ok  => TRUE,
2144                passed        => TRUE,
2145                is_ok         => TRUE,
2146                is_test       => TRUE,
2147                has_skip      => FALSE,
2148                has_todo      => FALSE,
2149                number        => 15,
2150                description =>
2151                  '- Check so that tid for threads work for main thread',
2152                explanation => '',
2153            },
2154        ],
2155        plan          => '1..15',
2156        passed        => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2157        actual_passed => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2158        failed        => [],
2159        actual_failed => [],
2160        todo          => [],
2161        todo_passed   => [],
2162        skipped       => [],
2163        is_good_plan  => FALSE,
2164        tests_planned => 15,
2165        tests_run     => 15,
2166
2167        # Note that tests 14 and 15 *are* in the correct sequence.
2168        parse_errors => [
2169            'Tests out of sequence.  Found (2) but expected (1)',
2170            'Tests out of sequence.  Found (3) but expected (2)',
2171            'Tests out of sequence.  Found (4) but expected (3)',
2172            'Tests out of sequence.  Found (6) but expected (4)',
2173            'Tests out of sequence.  Found (8) but expected (5)',
2174            'Tests out of sequence.  Found (9) but expected (6)',
2175            'Tests out of sequence.  Found (10) but expected (7)',
2176            'Tests out of sequence.  Found (11) but expected (8)',
2177            'Tests out of sequence.  Found (12) but expected (9)',
2178            'Tests out of sequence.  Found (13) but expected (10)',
2179            'Plan (1..15) must be at the beginning or end of the TAP output',
2180            'Tests out of sequence.  Found (1) but expected (11)',
2181            'Tests out of sequence.  Found (5) but expected (12)',
2182            'Tests out of sequence.  Found (7) but expected (13)',
2183        ],
2184        'exit' => 0,
2185        wait   => 0,
2186    },
2187    skipall => {
2188        results => [
2189            {   is_plan       => TRUE,
2190                raw           => '1..0 # skipping: rope',
2191                tests_planned => 0,
2192                passed        => TRUE,
2193                is_ok         => TRUE,
2194                directive     => 'SKIP',
2195                explanation   => 'rope'
2196            },
2197        ],
2198        plan          => '1..0',
2199        passed        => [],
2200        actual_passed => [],
2201        failed        => [],
2202        actual_failed => [],
2203        todo          => [],
2204        todo_passed   => [],
2205        skipped       => [],
2206        good_plan     => TRUE,
2207        is_good_plan  => TRUE,
2208        tests_planned => 0,
2209        tests_run     => 0,
2210        parse_errors  => [],
2211        'exit'        => 0,
2212        wait          => 0,
2213        version       => 12,
2214        skip_all      => 'rope',
2215    },
2216    skipall_v13 => {
2217        results => [
2218            {   is_version => TRUE,
2219                raw        => 'TAP version 13',
2220            },
2221            {   is_unknown => TRUE,
2222                raw        => '1..0 # skipping: rope',
2223            },
2224        ],
2225        plan          => '',
2226        passed        => [],
2227        actual_passed => [],
2228        failed        => [],
2229        actual_failed => [],
2230        todo          => [],
2231        todo_passed   => [],
2232        skipped       => [],
2233        good_plan     => FALSE,
2234        is_good_plan  => FALSE,
2235        tests_planned => FALSE,
2236        tests_run     => 0,
2237        parse_errors  => ['No plan found in TAP output'],
2238        'exit'        => 0,
2239        wait          => 0,
2240        version       => 13,
2241    },
2242    strict => {
2243        results => [
2244            {   is_version => TRUE,
2245                raw        => 'TAP version 13',
2246            },
2247            {   is_plan => TRUE,
2248                raw     => '1..1',
2249            },
2250            {   is_pragma => TRUE,
2251                raw       => 'pragma +strict',
2252                pragmas   => ['+strict'],
2253            },
2254            {   is_unknown => TRUE, raw => 'Nonsense!',
2255            },
2256            {   is_pragma => TRUE,
2257                raw       => 'pragma -strict',
2258                pragmas   => ['-strict'],
2259            },
2260            {   is_unknown => TRUE,
2261                raw        => "Doesn't matter.",
2262            },
2263            {   is_test => TRUE,
2264                raw     => 'ok 1 All OK',
2265            }
2266        ],
2267        plan          => '1..1',
2268        passed        => [1],
2269        actual_passed => [1],
2270        failed        => [],
2271        actual_failed => [],
2272        todo          => [],
2273        todo_passed   => [],
2274        skipped       => [],
2275        good_plan     => TRUE,
2276        is_good_plan  => TRUE,
2277        tests_planned => 1,
2278        tests_run     => 1,
2279        parse_errors  => ['Unknown TAP token: "Nonsense!"'],
2280        'exit'  => 0,    # TODO: Is this right???
2281        wait    => 0,
2282        version => 13,
2283    },
2284    skipall_nomsg => {
2285        results => [
2286            {   is_plan       => TRUE,
2287                raw           => '1..0',
2288                tests_planned => 0,
2289                passed        => TRUE,
2290                is_ok         => TRUE,
2291                directive     => 'SKIP',
2292                explanation   => ''
2293            },
2294        ],
2295        plan          => '1..0',
2296        passed        => [],
2297        actual_passed => [],
2298        failed        => [],
2299        actual_failed => [],
2300        todo          => [],
2301        todo_passed   => [],
2302        skipped       => [],
2303        good_plan     => TRUE,
2304        is_good_plan  => TRUE,
2305        tests_planned => 0,
2306        tests_run     => 0,
2307        parse_errors  => [],
2308        'exit'        => 0,
2309        wait          => 0,
2310        version       => 12,
2311        skip_all      => '(no reason given)',
2312    },
2313    todo_misparse => {
2314        results => [
2315            {   is_plan       => TRUE,
2316                raw           => '1..1',
2317                tests_planned => TRUE,
2318                passed        => TRUE,
2319                is_ok         => TRUE,
2320            },
2321            {   actual_passed => FALSE,
2322                is_actual_ok  => FALSE,
2323                passed        => FALSE,
2324                is_ok         => FALSE,
2325                is_test       => TRUE,
2326                has_skip      => FALSE,
2327                has_todo      => FALSE,
2328                number        => 1,
2329                description   => 'Hamlette # TODOORNOTTODO',
2330                explanation   => '',
2331            },
2332        ],
2333        plan          => '1..1',
2334        passed        => [],
2335        actual_passed => [],
2336        failed        => [1],
2337        actual_failed => [1],
2338        todo          => [],
2339        todo_passed   => [],
2340        skipped       => [],
2341        good_plan     => TRUE,
2342        is_good_plan  => TRUE,
2343        tests_planned => TRUE,
2344        tests_run     => 1,
2345        parse_errors  => [],
2346        'exit'        => 0,
2347        wait          => 0,
2348        version       => 12,
2349    },
2350    shbang_misparse => {
2351        results => [
2352            {   is_plan       => TRUE,
2353                raw           => '1..2',
2354                tests_planned => 2,
2355                passed        => TRUE,
2356                is_ok         => TRUE,
2357            },
2358            {   actual_passed => TRUE,
2359                is_actual_ok  => TRUE,
2360                description   => "",
2361                passed        => TRUE,
2362                is_ok         => TRUE,
2363                is_test       => TRUE,
2364                has_skip      => FALSE,
2365                has_todo      => FALSE,
2366                number        => 1,
2367            },
2368            {   actual_passed => TRUE,
2369                is_actual_ok  => TRUE,
2370                passed        => TRUE,
2371                is_ok         => TRUE,
2372                is_test       => TRUE,
2373                has_skip      => FALSE,
2374                has_todo      => FALSE,
2375                number        => 2,
2376                description   => "",
2377            },
2378        ],
2379        plan          => '1..2',
2380        passed        => [ 1 .. 2 ],
2381        actual_passed => [ 1 .. 2 ],
2382        failed        => [],
2383        actual_failed => [],
2384        todo          => [],
2385        todo_passed   => [],
2386        skipped       => [],
2387        good_plan     => TRUE,
2388        is_good_plan  => TRUE,
2389        tests_planned => 2,
2390        tests_run     => 2,
2391        parse_errors  => [],
2392        'exit'        => 0,
2393        wait          => 0,
2394        version       => 12,
2395    },
2396    switches => {
2397        results => [
2398            {   is_plan       => TRUE,
2399                passed        => TRUE,
2400                is_ok         => TRUE,
2401                raw           => '1..1',
2402                tests_planned => 1,
2403            },
2404            {   actual_passed => TRUE,
2405                is_actual_ok  => TRUE,
2406                passed        => TRUE,
2407                is_ok         => TRUE,
2408                is_test       => TRUE,
2409                has_skip      => FALSE,
2410                has_todo      => FALSE,
2411                number        => 1,
2412                description   => "",
2413                explanation   => '',
2414            },
2415        ],
2416        __ARGS__      => { switches => ['-Mstrict'] },
2417        plan          => '1..1',
2418        passed        => [1],
2419        actual_passed => [1],
2420        failed        => [],
2421        actual_failed => [],
2422        todo          => [],
2423        todo_passed   => [],
2424        skipped       => [],
2425        good_plan     => TRUE,
2426        is_good_plan  => TRUE,
2427        tests_planned => 1,
2428        tests_run     => TRUE,
2429        parse_errors  => [],
2430        'exit'        => 0,
2431        wait          => 0,
2432        version       => 12,
2433    },
2434    inc_taint => {
2435        results => [
2436            {   is_plan       => TRUE,
2437                passed        => TRUE,
2438                is_ok         => TRUE,
2439                raw           => '1..1',
2440                tests_planned => 1,
2441            },
2442            {   actual_passed => TRUE,
2443                is_actual_ok  => TRUE,
2444                passed        => TRUE,
2445                is_ok         => TRUE,
2446                is_test       => TRUE,
2447                has_skip      => FALSE,
2448                has_todo      => FALSE,
2449                number        => 1,
2450                description   => "",
2451                explanation   => '',
2452            },
2453        ],
2454        __ARGS__      => { switches => ['-Iexamples'] },
2455        plan          => '1..1',
2456        passed        => [1],
2457        actual_passed => [1],
2458        failed        => [],
2459        actual_failed => [],
2460        todo          => [],
2461        todo_passed   => [],
2462        skipped       => [],
2463        good_plan     => TRUE,
2464        is_good_plan  => TRUE,
2465        tests_planned => 1,
2466        tests_run     => TRUE,
2467        parse_errors  => [],
2468        'exit'        => 0,
2469        wait          => 0,
2470        version       => 12,
2471    },
2472    sequence_misparse => {
2473        results => [
2474            {   is_plan       => TRUE,
2475                raw           => '1..5',
2476                tests_planned => 5,
2477                passed        => TRUE,
2478                is_ok         => TRUE,
2479            },
2480            {   actual_passed => TRUE,
2481                is_actual_ok  => TRUE,
2482                passed        => TRUE,
2483                is_ok         => TRUE,
2484                is_test       => TRUE,
2485                has_skip      => FALSE,
2486                has_todo      => FALSE,
2487                number        => 1,
2488                description   => "",
2489            },
2490            {   actual_passed => TRUE,
2491                is_actual_ok  => TRUE,
2492                passed        => TRUE,
2493                is_ok         => TRUE,
2494                is_test       => TRUE,
2495                has_skip      => FALSE,
2496                has_todo      => FALSE,
2497                number        => 2,
2498                description   => "",
2499            },
2500            {   actual_passed => TRUE,
2501                is_actual_ok  => TRUE,
2502                passed        => TRUE,
2503                is_ok         => TRUE,
2504                is_test       => TRUE,
2505                has_skip      => FALSE,
2506                has_todo      => FALSE,
2507                number        => 3,
2508                description   => "\# skipped on foobar system",
2509            },
2510            {   is_comment => TRUE,
2511                comment    => '1234567890123456789012345678901234567890',
2512            },
2513            {   actual_passed => TRUE,
2514                is_actual_ok  => TRUE,
2515                passed        => TRUE,
2516                is_ok         => TRUE,
2517                is_test       => TRUE,
2518                has_skip      => FALSE,
2519                has_todo      => FALSE,
2520                number        => 4,
2521                description   => "",
2522            },
2523            {   is_comment => TRUE,
2524                comment    => '1234567890123456789012345678901234567890',
2525            },
2526            {   actual_passed => TRUE,
2527                is_actual_ok  => TRUE,
2528                passed        => TRUE,
2529                is_ok         => TRUE,
2530                is_test       => TRUE,
2531                has_skip      => FALSE,
2532                has_todo      => FALSE,
2533                number        => 5,
2534                description   => "",
2535            },
2536        ],
2537        plan          => '1..5',
2538        passed        => [ 1 .. 5 ],
2539        actual_passed => [ 1 .. 5 ],
2540        failed        => [],
2541        actual_failed => [],
2542        todo          => [],
2543        todo_passed   => [],
2544        skipped       => [],
2545        good_plan     => TRUE,
2546        is_good_plan  => TRUE,
2547        tests_planned => 5,
2548        tests_run     => 5,
2549        parse_errors  => [],
2550        'exit'        => 0,
2551        wait          => 0,
2552        version       => 12,
2553    },
2554
2555    # For some reason mixing stdout with stderr is unreliable on Windows
2556    (   $IsWin32
2557        ? ()
2558        : ( stdout_stderr => {
2559                results => [
2560                    {   is_comment => TRUE,
2561                        passed     => TRUE,
2562                        is_ok      => TRUE,
2563                        comment    => 'comments',
2564                    },
2565                    {   actual_passed => TRUE,
2566                        is_actual_ok  => TRUE,
2567                        passed        => TRUE,
2568                        is_ok         => TRUE,
2569                        is_test       => TRUE,
2570                        has_skip      => FALSE,
2571                        has_todo      => FALSE,
2572                        number        => 1,
2573                        description   => '',
2574                        explanation   => '',
2575                    },
2576                    {   actual_passed => TRUE,
2577                        is_actual_ok  => TRUE,
2578                        passed        => TRUE,
2579                        is_ok         => TRUE,
2580                        is_test       => TRUE,
2581                        has_skip      => FALSE,
2582                        has_todo      => FALSE,
2583                        number        => 2,
2584                        description   => '',
2585                        explanation   => '',
2586                    },
2587                    {   actual_passed => TRUE,
2588                        is_actual_ok  => TRUE,
2589                        passed        => TRUE,
2590                        is_ok         => TRUE,
2591                        is_test       => TRUE,
2592                        has_skip      => FALSE,
2593                        has_todo      => FALSE,
2594                        number        => 3,
2595                        description   => '',
2596                        explanation   => '',
2597                    },
2598                    {   is_comment => TRUE,
2599                        passed     => TRUE,
2600                        is_ok      => TRUE,
2601                        comment    => 'comment',
2602                    },
2603                    {   actual_passed => TRUE,
2604                        is_actual_ok  => TRUE,
2605                        passed        => TRUE,
2606                        is_ok         => TRUE,
2607                        is_test       => TRUE,
2608                        has_skip      => FALSE,
2609                        has_todo      => FALSE,
2610                        number        => 4,
2611                        description   => '',
2612                        explanation   => '',
2613                    },
2614                    {   is_comment => TRUE,
2615                        passed     => TRUE,
2616                        is_ok      => TRUE,
2617                        comment    => 'more ignored stuff',
2618                    },
2619                    {   is_comment => TRUE,
2620                        passed     => TRUE,
2621                        is_ok      => TRUE,
2622                        comment    => 'and yet more',
2623                    },
2624                    {   is_plan       => TRUE,
2625                        passed        => TRUE,
2626                        is_ok         => TRUE,
2627                        raw           => '1..4',
2628                        tests_planned => 4,
2629                    },
2630                ],
2631                plan          => '1..4',
2632                passed        => [ 1 .. 4 ],
2633                actual_passed => [ 1 .. 4 ],
2634                failed        => [],
2635                actual_failed => [],
2636                todo          => [],
2637                todo_passed   => [],
2638                skipped       => [],
2639                good_plan     => TRUE,
2640                is_good_plan  => TRUE,
2641                tests_planned => 4,
2642                tests_run     => 4,
2643                parse_errors  => [],
2644                'exit'        => 0,
2645                wait          => 0,
2646                version       => 12,
2647                need_open3    => 1,
2648            }
2649        )
2650    ),
2651
2652    junk_before_plan => {
2653        results => [
2654            {   is_unknown => TRUE,
2655                raw        => 'this is junk',
2656            },
2657            {   is_comment => TRUE,
2658                comment    => "this is a comment",
2659            },
2660            {   is_plan       => TRUE,
2661                passed        => TRUE,
2662                is_ok         => TRUE,
2663                raw           => '1..1',
2664                tests_planned => 1,
2665            },
2666            {   actual_passed => TRUE,
2667                is_actual_ok  => TRUE,
2668                passed        => TRUE,
2669                is_ok         => TRUE,
2670                is_test       => TRUE,
2671                has_skip      => FALSE,
2672                has_todo      => FALSE,
2673                number        => 1,
2674            },
2675        ],
2676        plan          => '1..1',
2677        passed        => [ 1 .. 1 ],
2678        actual_passed => [ 1 .. 1 ],
2679        failed        => [],
2680        actual_failed => [],
2681        todo          => [],
2682        todo_passed   => [],
2683        skipped       => [],
2684        good_plan     => TRUE,
2685        is_good_plan  => TRUE,
2686        tests_planned => 1,
2687        tests_run     => 1,
2688        parse_errors  => [],
2689        'exit'        => 0,
2690        wait          => 0,
2691        version       => 12,
2692    },
2693    version_good => {
2694        results => [
2695            {   is_version => TRUE,
2696                raw        => 'TAP version 13',
2697            },
2698            {   is_plan       => TRUE,
2699                raw           => '1..5',
2700                tests_planned => 5,
2701                passed        => TRUE,
2702                is_ok         => TRUE,
2703            },
2704            {   actual_passed => TRUE,
2705                is_actual_ok  => TRUE,
2706                passed        => TRUE,
2707                is_ok         => TRUE,
2708                is_test       => TRUE,
2709                has_skip      => FALSE,
2710                has_todo      => FALSE,
2711                number        => 1,
2712                description   => "",
2713            },
2714            {   actual_passed => TRUE,
2715                is_actual_ok  => TRUE,
2716                passed        => TRUE,
2717                is_ok         => TRUE,
2718                is_test       => TRUE,
2719                has_skip      => FALSE,
2720                has_todo      => FALSE,
2721                number        => 2,
2722                description   => "",
2723            },
2724            {   actual_passed => TRUE,
2725                is_actual_ok  => TRUE,
2726                passed        => TRUE,
2727                is_ok         => TRUE,
2728                is_test       => TRUE,
2729                has_skip      => FALSE,
2730                has_todo      => FALSE,
2731                number        => 3,
2732                description   => "",
2733            },
2734            {   actual_passed => TRUE,
2735                is_actual_ok  => TRUE,
2736                passed        => TRUE,
2737                is_ok         => TRUE,
2738                is_test       => TRUE,
2739                has_skip      => FALSE,
2740                has_todo      => FALSE,
2741                number        => 4,
2742                description   => "",
2743            },
2744            {   actual_passed => TRUE,
2745                is_actual_ok  => TRUE,
2746                passed        => TRUE,
2747                is_ok         => TRUE,
2748                is_test       => TRUE,
2749                has_skip      => FALSE,
2750                has_todo      => FALSE,
2751                number        => 5,
2752                description   => "",
2753            },
2754        ],
2755        plan          => '1..5',
2756        passed        => [ 1 .. 5 ],
2757        actual_passed => [ 1 .. 5 ],
2758        failed        => [],
2759        actual_failed => [],
2760        todo          => [],
2761        todo_passed   => [],
2762        skipped       => [],
2763        good_plan     => TRUE,
2764        is_good_plan  => TRUE,
2765        tests_planned => 5,
2766        tests_run     => 5,
2767        parse_errors  => [],
2768        'exit'        => 0,
2769        wait          => 0,
2770        version       => 13,
2771    },
2772    version_old => {
2773        results => [
2774            {   is_version => TRUE,
2775                raw        => 'TAP version 12',
2776            },
2777            {   is_plan       => TRUE,
2778                raw           => '1..5',
2779                tests_planned => 5,
2780                passed        => TRUE,
2781                is_ok         => TRUE,
2782            },
2783            {   actual_passed => TRUE,
2784                is_actual_ok  => TRUE,
2785                passed        => TRUE,
2786                is_ok         => TRUE,
2787                is_test       => TRUE,
2788                has_skip      => FALSE,
2789                has_todo      => FALSE,
2790                number        => 1,
2791                description   => "",
2792            },
2793            {   actual_passed => TRUE,
2794                is_actual_ok  => TRUE,
2795                passed        => TRUE,
2796                is_ok         => TRUE,
2797                is_test       => TRUE,
2798                has_skip      => FALSE,
2799                has_todo      => FALSE,
2800                number        => 2,
2801                description   => "",
2802            },
2803            {   actual_passed => TRUE,
2804                is_actual_ok  => TRUE,
2805                passed        => TRUE,
2806                is_ok         => TRUE,
2807                is_test       => TRUE,
2808                has_skip      => FALSE,
2809                has_todo      => FALSE,
2810                number        => 3,
2811                description   => "",
2812            },
2813            {   actual_passed => TRUE,
2814                is_actual_ok  => TRUE,
2815                passed        => TRUE,
2816                is_ok         => TRUE,
2817                is_test       => TRUE,
2818                has_skip      => FALSE,
2819                has_todo      => FALSE,
2820                number        => 4,
2821                description   => "",
2822            },
2823            {   actual_passed => TRUE,
2824                is_actual_ok  => TRUE,
2825                passed        => TRUE,
2826                is_ok         => TRUE,
2827                is_test       => TRUE,
2828                has_skip      => FALSE,
2829                has_todo      => FALSE,
2830                number        => 5,
2831                description   => "",
2832            },
2833        ],
2834        plan          => '1..5',
2835        passed        => [ 1 .. 5 ],
2836        actual_passed => [ 1 .. 5 ],
2837        failed        => [],
2838        actual_failed => [],
2839        todo          => [],
2840        todo_passed   => [],
2841        skipped       => [],
2842        good_plan     => TRUE,
2843        is_good_plan  => TRUE,
2844        tests_planned => 5,
2845        tests_run     => 5,
2846        parse_errors =>
2847          ['Explicit TAP version must be at least 13. Got version 12'],
2848        'exit'  => 0,
2849        wait    => 0,
2850        version => 12,
2851    },
2852    version_late => {
2853        results => [
2854            {   is_plan       => TRUE,
2855                raw           => '1..5',
2856                tests_planned => 5,
2857                passed        => TRUE,
2858                is_ok         => TRUE,
2859            },
2860            {   is_version => TRUE,
2861                raw        => 'TAP version 13',
2862            },
2863            {   actual_passed => TRUE,
2864                is_actual_ok  => TRUE,
2865                passed        => TRUE,
2866                is_ok         => TRUE,
2867                is_test       => TRUE,
2868                has_skip      => FALSE,
2869                has_todo      => FALSE,
2870                number        => 1,
2871                description   => "",
2872            },
2873            {   actual_passed => TRUE,
2874                is_actual_ok  => TRUE,
2875                passed        => TRUE,
2876                is_ok         => TRUE,
2877                is_test       => TRUE,
2878                has_skip      => FALSE,
2879                has_todo      => FALSE,
2880                number        => 2,
2881                description   => "",
2882            },
2883            {   actual_passed => TRUE,
2884                is_actual_ok  => TRUE,
2885                passed        => TRUE,
2886                is_ok         => TRUE,
2887                is_test       => TRUE,
2888                has_skip      => FALSE,
2889                has_todo      => FALSE,
2890                number        => 3,
2891                description   => "",
2892            },
2893            {   actual_passed => TRUE,
2894                is_actual_ok  => TRUE,
2895                passed        => TRUE,
2896                is_ok         => TRUE,
2897                is_test       => TRUE,
2898                has_skip      => FALSE,
2899                has_todo      => FALSE,
2900                number        => 4,
2901                description   => "",
2902            },
2903            {   actual_passed => TRUE,
2904                is_actual_ok  => TRUE,
2905                passed        => TRUE,
2906                is_ok         => TRUE,
2907                is_test       => TRUE,
2908                has_skip      => FALSE,
2909                has_todo      => FALSE,
2910                number        => 5,
2911                description   => "",
2912            },
2913        ],
2914        plan          => '1..5',
2915        passed        => [ 1 .. 5 ],
2916        actual_passed => [ 1 .. 5 ],
2917        failed        => [],
2918        actual_failed => [],
2919        todo          => [],
2920        todo_passed   => [],
2921        skipped       => [],
2922        good_plan     => TRUE,
2923        is_good_plan  => TRUE,
2924        tests_planned => 5,
2925        tests_run     => 5,
2926        parse_errors =>
2927          ['If TAP version is present it must be the first line of output'],
2928        'exit'  => 0,
2929        wait    => 0,
2930        version => 12,
2931    },
2932
2933    escape_eol => {
2934        results => [
2935            {   is_plan       => TRUE,
2936                raw           => '1..2',
2937                tests_planned => 2,
2938                passed        => TRUE,
2939                is_ok         => TRUE,
2940            },
2941            {   actual_passed => TRUE,
2942                is_actual_ok  => TRUE,
2943                description =>
2944                  'Should parse as literal backslash --> \\',
2945                passed       => TRUE,
2946                is_ok        => TRUE,
2947                is_test      => TRUE,
2948                has_skip     => FALSE,
2949                has_todo     => FALSE,
2950                number       => 1,
2951                is_unplanned => FALSE,
2952            },
2953            {   actual_passed => TRUE,
2954                is_actual_ok  => TRUE,
2955                passed        => TRUE,
2956                is_ok         => TRUE,
2957                is_test       => TRUE,
2958                has_skip      => FALSE,
2959                has_todo      => FALSE,
2960                number        => 2,
2961                description   => 'Not a continuation line',
2962                is_unplanned  => FALSE,
2963            },
2964        ],
2965        plan          => '1..2',
2966        passed        => [ 1 .. 2 ],
2967        actual_passed => [ 1 .. 2 ],
2968        failed        => [],
2969        actual_failed => [],
2970        todo          => [],
2971        todo_passed   => [],
2972        skipped       => [],
2973        good_plan     => TRUE,
2974        is_good_plan  => TRUE,
2975        tests_planned => 2,
2976        tests_run     => 2,
2977        parse_errors  => [],
2978        'exit'        => 0,
2979        wait          => 0,
2980        version       => 12,
2981    },
2982
2983    escape_hash => {
2984        results => [
2985            {   is_plan       => TRUE,
2986                raw           => '1..3',
2987                tests_planned => 3,
2988                passed        => TRUE,
2989                is_ok         => TRUE,
2990            },
2991            {   actual_passed => TRUE,
2992                is_actual_ok  => TRUE,
2993                description   => 'Not a \\# TODO',
2994                passed        => TRUE,
2995                is_ok         => TRUE,
2996                is_test       => TRUE,
2997                has_skip      => FALSE,
2998                has_todo      => FALSE,
2999                number        => 1,
3000                is_unplanned  => FALSE,
3001            },
3002            {   actual_passed => TRUE,
3003                is_actual_ok  => TRUE,
3004                passed        => TRUE,
3005                is_ok         => TRUE,
3006                is_test       => TRUE,
3007                has_skip      => FALSE,
3008                has_todo      => FALSE,
3009                number        => 2,
3010                description   => 'Not a \\# SKIP',
3011                is_unplanned  => FALSE,
3012            },
3013            {   actual_passed => TRUE,
3014                is_actual_ok  => TRUE,
3015                passed        => TRUE,
3016                is_ok         => TRUE,
3017                is_test       => TRUE,
3018                has_skip      => FALSE,
3019                has_todo      => FALSE,
3020                number        => 3,
3021                description   => 'Escaped \\\\\\#',
3022                is_unplanned  => FALSE,
3023            },
3024        ],
3025        plan          => '1..3',
3026        passed        => [ 1 .. 3 ],
3027        actual_passed => [ 1 .. 3 ],
3028        failed        => [],
3029        actual_failed => [],
3030        todo          => [],
3031        todo_passed   => [],
3032        skipped       => [],
3033        good_plan     => TRUE,
3034        is_good_plan  => TRUE,
3035        tests_planned => 3,
3036        tests_run     => 3,
3037        parse_errors  => [],
3038        'exit'        => 0,
3039        wait          => 0,
3040        version       => 12,
3041    },
3042
3043    zero_valid => {
3044        results => [
3045            {   is_plan       => TRUE,
3046                raw           => '1..5',
3047                tests_planned => 5,
3048                passed        => TRUE,
3049                is_ok         => TRUE,
3050            },
3051            {   actual_passed => TRUE,
3052                is_actual_ok  => TRUE,
3053                description   => '- One',
3054                passed        => TRUE,
3055                is_ok         => TRUE,
3056                is_test       => TRUE,
3057                has_skip      => FALSE,
3058                has_todo      => FALSE,
3059                number        => 1,
3060                is_unplanned  => FALSE,
3061            },
3062            {   actual_passed => TRUE,
3063                is_actual_ok  => TRUE,
3064                description   => '- Two',
3065                passed        => TRUE,
3066                is_ok         => TRUE,
3067                is_test       => TRUE,
3068                has_skip      => FALSE,
3069                has_todo      => FALSE,
3070                number        => 2,
3071                is_unplanned  => FALSE,
3072            },
3073            {   actual_passed => TRUE,
3074                is_actual_ok  => TRUE,
3075                description   => '- Three',
3076                passed        => TRUE,
3077                is_ok         => TRUE,
3078                is_test       => TRUE,
3079                has_skip      => FALSE,
3080                has_todo      => FALSE,
3081                number        => 3,
3082                is_unplanned  => FALSE,
3083            },
3084            {   actual_passed => TRUE,
3085                is_actual_ok  => TRUE,
3086                description   => '- Four',
3087                passed        => TRUE,
3088                is_ok         => TRUE,
3089                is_test       => TRUE,
3090                has_skip      => FALSE,
3091                has_todo      => FALSE,
3092                number        => 0,
3093                is_unplanned  => FALSE,
3094            },
3095            {   actual_passed => TRUE,
3096                is_actual_ok  => TRUE,
3097                description   => '- Five',
3098                passed        => TRUE,
3099                is_ok         => TRUE,
3100                is_test       => TRUE,
3101                has_skip      => FALSE,
3102                has_todo      => FALSE,
3103                number        => 5,
3104                is_unplanned  => FALSE,
3105            },
3106        ],
3107        plan          => '1..5',
3108        passed        => [ 1 .. 3, 0, 5 ],
3109        actual_passed => [ 1 .. 3, 0, 5 ],
3110        failed        => [],
3111        actual_failed => [],
3112        todo          => [],
3113        todo_passed   => [],
3114        skipped       => [],
3115        good_plan     => TRUE,
3116        is_good_plan  => TRUE,
3117        tests_planned => 5,
3118        tests_run     => 5,
3119        parse_errors  => [
3120            'Tests out of sequence.  Found (0) but expected (4)',
3121        ],
3122        'exit'  => 0,
3123        wait    => 0,
3124        version => 12,
3125    },
3126);
3127
3128my %HANDLER_FOR = (
3129    NOT_ZERO, sub { local $^W; 0 != shift },
3130    TRUE,     sub { local $^W; !!shift },
3131    FALSE,    sub { local $^W; !shift },
3132);
3133
3134my $can_open3 = ( $Config{d_fork} || $IsWin32 ) ? 1 : 0;
3135
3136for my $hide_fork ( 0 .. $can_open3 ) {
3137    if ($hide_fork) {
3138        no strict 'refs';
3139        local $^W = 0;
3140        *{'TAP::Parser::Iterator::Process::_use_open3'} = sub {return};
3141    }
3142
3143    TEST:
3144    for my $test ( sort keys %samples ) {
3145
3146        #next unless 'empty' eq $test;
3147        my %details = %{ $samples{$test} };
3148
3149        if ( my $skip_if = delete $details{skip_if} ) {
3150            next TEST if $skip_if->();
3151        }
3152
3153        my $results    = delete $details{results};
3154        my $args       = delete $details{__ARGS__};
3155        my $need_open3 = delete $details{need_open3};
3156
3157        next TEST if $need_open3 && ( $hide_fork || !$can_open3 );
3158
3159        # the following acrobatics are necessary to make it easy for the
3160        # Test::Builder::failure_output() method to be overridden when
3161        # TAP::Parser is not installed.  Otherwise, these tests will fail.
3162
3163        unshift @{ $args->{switches} },
3164          $ENV{PERL_CORE} ? ( map {"-I$_"} @INC ) : ('-It/lib');
3165
3166        $args->{source} = File::Spec->catfile( $SAMPLE_TESTS, $test );
3167        $args->{merge} = !$hide_fork;
3168
3169        my $parser = eval { analyze_test( $test, [@$results], $args ) };
3170        my $error = $@;
3171        ok !$error, "'$test' should parse successfully"
3172          or diag $error;
3173
3174        if ($error) {
3175            my $tests = 0;
3176            while ( my ( $method, $answer ) = each %details ) {
3177                $tests += ref $answer ? 2 : 1;
3178            }
3179            SKIP: {
3180                skip "$test did not parse successfully", $tests;
3181            }
3182        }
3183        else {
3184            while ( my ( $method, $answer ) = each %details ) {
3185                if ( my $handler = $HANDLER_FOR{ $answer || '' } ) {    # yuck
3186                    ok $handler->( $parser->$method() ),
3187                      "... and $method should return a reasonable value ($test)";
3188                }
3189                elsif ( !ref $answer ) {
3190                    local $^W;    # uninit warnings
3191
3192                    $answer = _vmsify_answer( $method, $answer );
3193
3194                    is $parser->$method(), $answer,
3195                      "... and $method should equal $answer ($test)";
3196                }
3197                else {
3198                    is scalar $parser->$method(), scalar @$answer,
3199                      "... and $method should be the correct amount ($test)";
3200                    is_deeply [ $parser->$method() ], $answer,
3201                      "... and $method should be the correct values ($test)";
3202                }
3203            }
3204        }
3205    }
3206}
3207
3208my %Unix2VMS_Exit_Codes = ( 1 => 4, );
3209
3210sub _vmsify_answer {
3211    my ( $method, $answer ) = @_;
3212
3213    return $answer unless $IsVMS;
3214
3215    if ( $method eq 'exit'
3216        and exists $Unix2VMS_Exit_Codes{$answer} )
3217    {
3218        $answer = $Unix2VMS_Exit_Codes{$answer};
3219    }
3220
3221    return $answer;
3222}
3223
3224sub analyze_test {
3225    my ( $test, $results, $args ) = @_;
3226
3227    my $parser = TAP::Parser->new($args);
3228    my $count  = 1;
3229    while ( defined( my $result = $parser->next ) ) {
3230
3231        my $expected = shift @$results;
3232        my $desc
3233          = $result->is_test
3234          ? $result->description
3235          : $result->raw;
3236        $desc = $result->plan
3237          if $result->is_plan && $desc =~ /SKIP/i;
3238        $desc =~ s/#/<hash>/g;
3239        $desc =~ s/\s+/ /g;      # Drop newlines
3240        ok defined $expected,
3241          "$test/$count We should have a result for $desc";
3242        while ( my ( $method, $answer ) = each %$expected ) {
3243
3244            if ( my $handler = $HANDLER_FOR{ $answer || '' } ) {    # yuck
3245                ok $handler->( $result->$method() ),
3246                  "... and $method should return a reasonable value ($test/$count)";
3247            }
3248            elsif ( ref $answer ) {
3249                is_deeply scalar( $result->$method() ), $answer,
3250                  "... and $method should return the correct structure ($test/$count)";
3251            }
3252            else {
3253                is $result->$method(), $answer,
3254                  "... and $method should return the correct answer ($test/$count)";
3255            }
3256        }
3257        $count++;
3258    }
3259    is @$results, 0,
3260      "... and we should have the correct number of results ($test)";
3261    return $parser;
3262}
3263
3264# vms_nit
3265