4 chdir 't' and @INC = '../lib' if $ENV{PERL_CORE};
10 use Test::More 'no_plan';
15 use constant TRUE => "__TRUE__";
16 use constant FALSE => "__FALSE__";
18 # if wait() is non-zero, we cannot reliably predict its value
19 use constant NOT_ZERO => "__NOT_ZERO__";
23 my $IsVMS = $^O eq 'VMS';
24 my $IsWin32 = $^O eq 'MSWin32';
27 = File::Spec->catdir( File::Spec->curdir, ($ENV{PERL_CORE} ? 'lib' : 't'),
30 my %deprecated = map { $_ => 1 } qw(
31 TAP::Parser::good_plan
32 TAP::Parser::Result::Plan::passed
33 TAP::Parser::Result::Test::passed
34 TAP::Parser::Result::Test::actual_passed
35 TAP::Parser::Result::passed
37 $SIG{__WARN__} = sub {
38 if ( $_[0] =~ /is deprecated/ ) {
39 my @caller = caller(1);
41 ok exists $deprecated{$sub},
42 "... we should get a deprecated warning for $sub";
49 # the %samples keys are the names of test scripts in t/sample-tests
59 { actual_passed => TRUE,
61 description => "Interlock activated",
68 is_unplanned => FALSE,
70 { actual_passed => TRUE,
78 description => "Megathrusters are go",
79 is_unplanned => FALSE,
81 { actual_passed => TRUE,
89 description => "Head formed",
90 is_unplanned => FALSE,
92 { actual_passed => TRUE,
100 description => "Blazing sword formed",
101 is_unplanned => FALSE,
103 { actual_passed => TRUE,
104 is_actual_ok => TRUE,
111 description => "Robeast destroyed",
112 is_unplanned => FALSE,
116 passed => [ 1 .. 5 ],
117 actual_passed => [ 1 .. 5 ],
124 is_good_plan => TRUE,
132 descriptive_trailing => {
134 { actual_passed => TRUE,
135 is_actual_ok => TRUE,
136 description => "Interlock activated",
143 is_unplanned => FALSE,
145 { actual_passed => TRUE,
146 is_actual_ok => TRUE,
153 description => "Megathrusters are go",
154 is_unplanned => FALSE,
156 { actual_passed => TRUE,
157 is_actual_ok => TRUE,
164 description => "Head formed",
165 is_unplanned => FALSE,
167 { actual_passed => TRUE,
168 is_actual_ok => TRUE,
175 description => "Blazing sword formed",
176 is_unplanned => FALSE,
178 { actual_passed => TRUE,
179 is_actual_ok => TRUE,
186 description => "Robeast destroyed",
187 is_unplanned => FALSE,
197 passed => [ 1 .. 5 ],
198 actual_passed => [ 1 .. 5 ],
205 is_good_plan => TRUE,
224 is_good_plan => FALSE,
225 tests_planned => undef,
227 parse_errors => ['No plan found in TAP output'],
240 { actual_passed => TRUE,
241 is_actual_ok => TRUE,
250 { actual_passed => TRUE,
251 is_actual_ok => TRUE,
260 { actual_passed => TRUE,
261 is_actual_ok => TRUE,
270 { actual_passed => TRUE,
271 is_actual_ok => TRUE,
280 { actual_passed => TRUE,
281 is_actual_ok => TRUE,
292 passed => [ 1 .. 5 ],
293 actual_passed => [ 1 .. 5 ],
300 is_good_plan => TRUE,
308 space_after_plan => {
316 { actual_passed => TRUE,
317 is_actual_ok => TRUE,
326 { actual_passed => TRUE,
327 is_actual_ok => TRUE,
336 { actual_passed => TRUE,
337 is_actual_ok => TRUE,
346 { actual_passed => TRUE,
347 is_actual_ok => TRUE,
356 { actual_passed => TRUE,
357 is_actual_ok => TRUE,
368 passed => [ 1 .. 5 ],
369 actual_passed => [ 1 .. 5 ],
376 is_good_plan => TRUE,
386 { is_version => TRUE,
387 raw => 'TAP version 13',
395 { actual_passed => TRUE,
396 is_actual_ok => TRUE,
405 { actual_passed => TRUE,
406 is_actual_ok => TRUE,
417 { 'fnurk' => 'skib', 'ponk' => 'gleeb' },
418 { 'bar' => 'krup', 'foo' => 'plink' }
421 " ---\n -\n fnurk: skib\n ponk: gleeb\n -\n bar: krup\n foo: plink\n ...",
423 { actual_passed => TRUE,
424 is_actual_ok => TRUE,
433 { actual_passed => TRUE,
434 is_actual_ok => TRUE,
445 'got' => [ '1', 'pong', '4' ],
446 'expected' => [ '1', '2', '4' ]
449 " ---\n expected:\n - 1\n - 2\n - 4\n got:\n - 1\n - pong\n - 4\n ...",
451 { actual_passed => TRUE,
452 is_actual_ok => TRUE,
463 passed => [ 1 .. 5 ],
464 actual_passed => [ 1 .. 5 ],
471 is_good_plan => TRUE,
487 { actual_passed => TRUE,
488 is_actual_ok => TRUE,
497 { actual_passed => FALSE,
498 is_actual_ok => FALSE,
507 { actual_passed => TRUE,
508 is_actual_ok => TRUE,
517 { actual_passed => TRUE,
518 is_actual_ok => TRUE,
527 { actual_passed => FALSE,
528 is_actual_ok => FALSE,
539 passed => [ 1, 3, 4 ],
540 actual_passed => [ 1, 3, 4 ],
542 actual_failed => [ 2, 5 ],
547 is_good_plan => TRUE,
563 { actual_passed => TRUE,
564 is_actual_ok => TRUE,
573 { actual_passed => TRUE,
574 is_actual_ok => TRUE,
582 explanation => 'rain delay',
584 { actual_passed => TRUE,
585 is_actual_ok => TRUE,
594 { actual_passed => TRUE,
595 is_actual_ok => TRUE,
604 { actual_passed => TRUE,
605 is_actual_ok => TRUE,
616 passed => [ 1 .. 5 ],
617 actual_passed => [ 1 .. 5 ],
624 is_good_plan => TRUE,
640 { actual_passed => TRUE,
641 is_actual_ok => TRUE,
654 actual_passed => [1],
661 is_good_plan => TRUE,
677 { actual_passed => FALSE,
678 is_actual_ok => FALSE,
685 description => "- Foo",
686 explanation => 'Just testing the todo interface.',
688 { actual_passed => TRUE,
689 is_actual_ok => TRUE,
696 description => "- Unexpected success",
697 explanation => 'Just testing the todo interface.',
699 { actual_passed => TRUE,
700 is_actual_ok => TRUE,
707 description => "- This is not todo",
712 passed => [ 1, 2, 3 ],
713 actual_passed => [ 2, 3 ],
715 actual_failed => [1],
720 is_good_plan => TRUE,
733 raw => '1..5 todo 3 2;',
735 todo_list => [ 3, 2 ],
737 { actual_passed => TRUE,
738 is_actual_ok => TRUE,
748 { actual_passed => TRUE,
749 is_actual_ok => TRUE,
759 { actual_passed => FALSE,
760 is_actual_ok => FALSE,
770 { actual_passed => TRUE,
771 is_actual_ok => TRUE,
781 { actual_passed => TRUE,
782 is_actual_ok => TRUE,
794 passed => [ 1, 2, 3, 4, 5 ],
795 actual_passed => [ 1, 2, 4, 5 ],
797 actual_failed => [3],
802 is_good_plan => TRUE,
818 { actual_passed => TRUE,
819 is_actual_ok => TRUE,
828 is_unplanned => FALSE,
830 { actual_passed => TRUE,
831 is_actual_ok => TRUE,
840 is_unplanned => FALSE,
842 { actual_passed => TRUE,
843 is_actual_ok => TRUE,
852 is_unplanned => FALSE,
854 { actual_passed => TRUE,
855 is_actual_ok => TRUE,
864 is_unplanned => FALSE,
866 { actual_passed => TRUE,
867 is_actual_ok => TRUE,
876 is_unplanned => FALSE,
878 { actual_passed => TRUE,
879 is_actual_ok => TRUE,
888 is_unplanned => FALSE,
890 { actual_passed => TRUE,
891 is_actual_ok => TRUE,
900 is_unplanned => FALSE,
902 { actual_passed => TRUE,
903 is_actual_ok => TRUE,
912 is_unplanned => FALSE,
914 { actual_passed => TRUE,
915 is_actual_ok => TRUE,
924 is_unplanned => FALSE,
926 { actual_passed => TRUE,
927 is_actual_ok => TRUE,
936 is_unplanned => FALSE,
938 { actual_passed => TRUE,
939 is_actual_ok => TRUE,
948 is_unplanned => TRUE,
952 passed => [ 1 .. 4, 4 .. 9 ],
953 actual_passed => [ 1 .. 4, 4 .. 10 ],
963 'Tests out of sequence. Found (4) but expected (5)',
964 'Tests out of sequence. Found (5) but expected (6)',
965 'Tests out of sequence. Found (6) but expected (7)',
966 'Tests out of sequence. Found (7) but expected (8)',
967 'Tests out of sequence. Found (8) but expected (9)',
968 'Tests out of sequence. Found (9) but expected (10)',
969 'Tests out of sequence. Found (10) but expected (11)',
970 'Bad plan. You planned 10 tests but ran 11.',
983 { actual_passed => TRUE,
984 is_actual_ok => TRUE,
993 { actual_passed => TRUE,
994 is_actual_ok => TRUE,
1003 { actual_passed => FALSE,
1004 is_actual_ok => FALSE,
1013 { actual_passed => TRUE,
1014 is_actual_ok => TRUE,
1023 { actual_passed => TRUE,
1024 is_actual_ok => TRUE,
1035 passed => [ 1, 2, 4, 5 ],
1036 actual_passed => [ 1, 2, 4, 5 ],
1038 actual_failed => [3],
1043 is_good_plan => TRUE,
1059 { actual_passed => TRUE,
1060 is_actual_ok => TRUE,
1069 { actual_passed => TRUE,
1070 is_actual_ok => TRUE,
1079 { actual_passed => TRUE,
1080 is_actual_ok => TRUE,
1089 { is_bailout => TRUE,
1090 explanation => "GERONIMMMOOOOOO!!!",
1092 { actual_passed => TRUE,
1093 is_actual_ok => TRUE,
1102 { actual_passed => TRUE,
1103 is_actual_ok => TRUE,
1114 passed => [ 1 .. 5 ],
1115 actual_passed => [ 1 .. 5 ],
1117 actual_failed => [],
1122 is_good_plan => TRUE,
1134 actual_passed => [],
1136 actual_failed => [],
1141 tests_planned => undef,
1143 parse_errors => [ 'No plan found in TAP output', ],
1155 { actual_passed => TRUE,
1156 is_actual_ok => TRUE,
1164 is_unplanned => FALSE,
1166 { actual_passed => TRUE,
1167 is_actual_ok => TRUE,
1175 is_unplanned => FALSE,
1177 { actual_passed => TRUE,
1178 is_actual_ok => TRUE,
1186 is_unplanned => FALSE,
1188 { actual_passed => TRUE,
1189 is_actual_ok => TRUE,
1197 is_unplanned => TRUE,
1199 { actual_passed => TRUE,
1200 is_actual_ok => TRUE,
1208 is_unplanned => TRUE,
1210 { actual_passed => TRUE,
1211 is_actual_ok => TRUE,
1219 is_unplanned => TRUE,
1221 { actual_passed => TRUE,
1222 is_actual_ok => TRUE,
1230 is_unplanned => TRUE,
1234 passed => [ 1 .. 3 ],
1235 actual_passed => [ 1 .. 7 ],
1236 failed => [ 4 .. 7 ],
1237 actual_failed => [],
1244 parse_errors => ['Bad plan. You planned 3 tests but ran 7.'],
1247 skip_if => sub {$IsVMS},
1255 tests_planned => TRUE,
1257 { actual_passed => TRUE,
1258 is_actual_ok => TRUE,
1259 description => "- -T honored",
1269 passed => [ 1 .. 1 ],
1270 actual_passed => [ 1 .. 1 ],
1272 actual_failed => [],
1277 is_good_plan => TRUE,
1278 tests_planned => TRUE,
1289 actual_passed => [],
1291 actual_failed => [],
1296 tests_planned => undef,
1298 parse_errors => [ 'No plan found in TAP output', ],
1304 { actual_passed => TRUE,
1305 is_actual_ok => TRUE,
1315 { actual_passed => TRUE,
1316 is_actual_ok => TRUE,
1326 { actual_passed => TRUE,
1327 is_actual_ok => TRUE,
1337 { actual_passed => TRUE,
1338 is_actual_ok => TRUE,
1350 passed => [ 1 .. 4 ],
1351 actual_passed => [ 1 .. 4 ],
1353 actual_failed => [],
1358 tests_planned => undef,
1360 parse_errors => [ 'No plan found in TAP output', ],
1364 die_last_minute => {
1366 { actual_passed => TRUE,
1367 is_actual_ok => TRUE,
1377 { actual_passed => TRUE,
1378 is_actual_ok => TRUE,
1388 { actual_passed => TRUE,
1389 is_actual_ok => TRUE,
1399 { actual_passed => TRUE,
1400 is_actual_ok => TRUE,
1418 passed => [ 1 .. 4 ],
1419 actual_passed => [ 1 .. 4 ],
1421 actual_failed => [],
1426 is_good_plan => TRUE,
1441 { actual_passed => TRUE,
1442 is_actual_ok => TRUE,
1452 { actual_passed => TRUE,
1453 is_actual_ok => TRUE,
1463 { actual_passed => TRUE,
1464 is_actual_ok => TRUE,
1470 number => 136211425,
1474 { actual_passed => TRUE,
1475 is_actual_ok => TRUE,
1481 number => 136211426,
1488 actual_passed => [ 1, 2, 136211425, 136211426 ],
1489 failed => [ 136211425, 136211426 ],
1490 actual_failed => [],
1498 'Tests out of sequence. Found (136211425) but expected (3)',
1499 'Tests out of sequence. Found (136211426) but expected (4)',
1500 'Bad plan. You planned 2 tests but ran 4.'
1513 { actual_passed => TRUE,
1514 is_actual_ok => TRUE,
1524 { actual_passed => TRUE,
1525 is_actual_ok => TRUE,
1535 { actual_passed => TRUE,
1536 is_actual_ok => TRUE,
1546 { actual_passed => TRUE,
1547 is_actual_ok => TRUE,
1557 { actual_passed => TRUE,
1558 is_actual_ok => TRUE,
1568 { actual_passed => TRUE,
1569 is_actual_ok => TRUE,
1579 { actual_passed => TRUE,
1580 is_actual_ok => TRUE,
1590 { actual_passed => TRUE,
1591 is_actual_ok => TRUE,
1601 { actual_passed => TRUE,
1602 is_actual_ok => TRUE,
1612 { actual_passed => TRUE,
1613 is_actual_ok => TRUE,
1623 { actual_passed => TRUE,
1624 is_actual_ok => TRUE,
1637 actual_passed => [ 1, 2, 99997 .. 100005 ],
1638 failed => [ 99997 .. 100005 ],
1639 actual_failed => [],
1647 'Tests out of sequence. Found (99997) but expected (3)',
1648 'Tests out of sequence. Found (99998) but expected (4)',
1649 'Tests out of sequence. Found (99999) but expected (5)',
1650 'Tests out of sequence. Found (100000) but expected (6)',
1651 'Tests out of sequence. Found (100001) but expected (7)',
1652 'Tests out of sequence. Found (100002) but expected (8)',
1653 'Tests out of sequence. Found (100003) but expected (9)',
1654 'Tests out of sequence. Found (100004) but expected (10)',
1655 'Tests out of sequence. Found (100005) but expected (11)',
1656 'Bad plan. You planned 2 tests but ran 11.'
1667 tests_planned => 10,
1669 { actual_passed => TRUE,
1670 is_actual_ok => TRUE,
1680 { actual_passed => TRUE,
1681 is_actual_ok => TRUE,
1688 description => 'basset hounds got long ears',
1691 { actual_passed => FALSE,
1692 is_actual_ok => FALSE,
1699 description => 'all hell broke loose',
1702 { actual_passed => FALSE,
1703 is_actual_ok => FALSE,
1711 explanation => 'if I heard a voice from heaven ...',
1713 { actual_passed => TRUE,
1714 is_actual_ok => TRUE,
1721 description => 'say "live without loving",',
1724 { actual_passed => TRUE,
1725 is_actual_ok => TRUE,
1732 description => "I'd beg off.",
1735 { actual_passed => TRUE,
1736 is_actual_ok => TRUE,
1744 explanation => 'contract negotiations',
1746 { actual_passed => TRUE,
1747 is_actual_ok => TRUE,
1754 description => 'Girls are such exquisite hell',
1757 { actual_passed => TRUE,
1758 is_actual_ok => TRUE,
1765 description => 'Elegy 9B',
1768 { actual_passed => FALSE,
1769 is_actual_ok => FALSE,
1781 passed => [ 1 .. 2, 4 .. 9 ],
1782 actual_passed => [ 1 .. 2, 5 .. 9 ],
1783 failed => [ 3, 10 ],
1784 actual_failed => [ 3, 4, 10 ],
1789 is_good_plan => TRUE,
1790 tests_planned => 10,
1799 { is_comment => TRUE,
1802 comment => 'comments',
1804 { actual_passed => TRUE,
1805 is_actual_ok => TRUE,
1815 { actual_passed => TRUE,
1816 is_actual_ok => TRUE,
1826 { actual_passed => TRUE,
1827 is_actual_ok => TRUE,
1837 { actual_passed => TRUE,
1838 is_actual_ok => TRUE,
1848 { is_comment => TRUE,
1851 comment => 'comment',
1859 { is_comment => TRUE,
1862 comment => 'more ignored stuff',
1864 { is_comment => TRUE,
1867 comment => 'and yet more',
1871 passed => [ 1 .. 4 ],
1872 actual_passed => [ 1 .. 4 ],
1874 actual_failed => [],
1879 is_good_plan => TRUE,
1889 { is_comment => TRUE,
1892 comment => 'comments',
1894 { actual_passed => TRUE,
1895 is_actual_ok => TRUE,
1905 { actual_passed => FALSE,
1906 is_actual_ok => FALSE,
1916 { actual_passed => TRUE,
1917 is_actual_ok => TRUE,
1927 { actual_passed => TRUE,
1928 is_actual_ok => TRUE,
1938 { is_comment => TRUE,
1941 comment => 'comment',
1949 { is_comment => TRUE,
1952 comment => 'more ignored stuff',
1954 { is_comment => TRUE,
1957 comment => 'and yet more',
1961 passed => [ 1, 3, 4 ],
1962 actual_passed => [ 1, 3, 4 ],
1964 actual_failed => [2],
1969 is_good_plan => TRUE,
1979 { actual_passed => TRUE,
1980 is_actual_ok => TRUE,
1987 description => '- Test that argument passing works',
1990 { actual_passed => TRUE,
1991 is_actual_ok => TRUE,
1999 '- Test that passing arguments as references work',
2002 { actual_passed => TRUE,
2003 is_actual_ok => TRUE,
2010 description => '- Test a normal sub',
2013 { actual_passed => TRUE,
2014 is_actual_ok => TRUE,
2021 description => '- Detach test',
2024 { actual_passed => TRUE,
2025 is_actual_ok => TRUE,
2032 description => '- Nested thread test',
2035 { actual_passed => TRUE,
2036 is_actual_ok => TRUE,
2043 description => '- Nested thread test',
2046 { actual_passed => TRUE,
2047 is_actual_ok => TRUE,
2054 description => '- Wanted 7, got 7',
2057 { actual_passed => TRUE,
2058 is_actual_ok => TRUE,
2065 description => '- Wanted 7, got 7',
2068 { actual_passed => TRUE,
2069 is_actual_ok => TRUE,
2076 description => '- Wanted 8, got 8',
2079 { actual_passed => TRUE,
2080 is_actual_ok => TRUE,
2087 description => '- Wanted 8, got 8',
2094 tests_planned => 15,
2096 { actual_passed => TRUE,
2097 is_actual_ok => TRUE,
2107 { actual_passed => TRUE,
2108 is_actual_ok => TRUE,
2115 description => '- Check that Config::threads is true',
2118 { actual_passed => TRUE,
2119 is_actual_ok => TRUE,
2126 description => '- Detach test',
2129 { actual_passed => TRUE,
2130 is_actual_ok => TRUE,
2138 '- Check so that tid for threads work for main thread',
2141 { actual_passed => TRUE,
2142 is_actual_ok => TRUE,
2150 '- Check so that tid for threads work for main thread',
2155 passed => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2156 actual_passed => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2158 actual_failed => [],
2162 is_good_plan => FALSE,
2163 tests_planned => 15,
2166 # Note that tests 14 and 15 *are* in the correct sequence.
2168 'Tests out of sequence. Found (2) but expected (1)',
2169 'Tests out of sequence. Found (3) but expected (2)',
2170 'Tests out of sequence. Found (4) but expected (3)',
2171 'Tests out of sequence. Found (6) but expected (4)',
2172 'Tests out of sequence. Found (8) but expected (5)',
2173 'Tests out of sequence. Found (9) but expected (6)',
2174 'Tests out of sequence. Found (10) but expected (7)',
2175 'Tests out of sequence. Found (11) but expected (8)',
2176 'Tests out of sequence. Found (12) but expected (9)',
2177 'Tests out of sequence. Found (13) but expected (10)',
2178 'Plan (1..15) must be at the beginning or end of the TAP output',
2179 'Tests out of sequence. Found (1) but expected (11)',
2180 'Tests out of sequence. Found (5) but expected (12)',
2181 'Tests out of sequence. Found (7) but expected (13)',
2189 raw => '1..0 # skipping: rope',
2193 directive => 'SKIP',
2194 explanation => 'rope'
2199 actual_passed => [],
2201 actual_failed => [],
2206 is_good_plan => TRUE,
2217 { is_version => TRUE,
2218 raw => 'TAP version 13',
2220 { is_unknown => TRUE,
2221 raw => '1..0 # skipping: rope',
2226 actual_passed => [],
2228 actual_failed => [],
2233 is_good_plan => FALSE,
2234 tests_planned => FALSE,
2236 parse_errors => ['No plan found in TAP output'],
2248 directive => 'SKIP',
2254 actual_passed => [],
2256 actual_failed => [],
2261 is_good_plan => TRUE,
2268 skip_all => '(no reason given)',
2274 tests_planned => TRUE,
2278 { actual_passed => FALSE,
2279 is_actual_ok => FALSE,
2286 description => 'Hamlette # TODOORNOTTODO',
2292 actual_passed => [],
2294 actual_failed => [1],
2299 is_good_plan => TRUE,
2300 tests_planned => TRUE,
2307 shbang_misparse => {
2315 { actual_passed => TRUE,
2316 is_actual_ok => TRUE,
2325 { actual_passed => TRUE,
2326 is_actual_ok => TRUE,
2337 passed => [ 1 .. 2 ],
2338 actual_passed => [ 1 .. 2 ],
2340 actual_failed => [],
2345 is_good_plan => TRUE,
2361 { actual_passed => TRUE,
2362 is_actual_ok => TRUE,
2373 __ARGS__ => { switches => ['-Mstrict'] },
2376 actual_passed => [1],
2378 actual_failed => [],
2383 is_good_plan => TRUE,
2399 { actual_passed => TRUE,
2400 is_actual_ok => TRUE,
2411 __ARGS__ => { switches => ['-Iexamples'] },
2414 actual_passed => [1],
2416 actual_failed => [],
2421 is_good_plan => TRUE,
2429 sequence_misparse => {
2437 { actual_passed => TRUE,
2438 is_actual_ok => TRUE,
2447 { actual_passed => TRUE,
2448 is_actual_ok => TRUE,
2457 { actual_passed => TRUE,
2458 is_actual_ok => TRUE,
2465 description => "\# skipped on foobar system",
2467 { is_comment => TRUE,
2468 comment => '1234567890123456789012345678901234567890',
2470 { actual_passed => TRUE,
2471 is_actual_ok => TRUE,
2480 { is_comment => TRUE,
2481 comment => '1234567890123456789012345678901234567890',
2483 { actual_passed => TRUE,
2484 is_actual_ok => TRUE,
2495 passed => [ 1 .. 5 ],
2496 actual_passed => [ 1 .. 5 ],
2498 actual_failed => [],
2503 is_good_plan => TRUE,
2514 { is_comment => TRUE,
2517 comment => 'comments',
2519 { actual_passed => TRUE,
2520 is_actual_ok => TRUE,
2530 { actual_passed => TRUE,
2531 is_actual_ok => TRUE,
2541 { actual_passed => TRUE,
2542 is_actual_ok => TRUE,
2552 { is_comment => TRUE,
2555 comment => 'comment',
2557 { actual_passed => TRUE,
2558 is_actual_ok => TRUE,
2568 { is_comment => TRUE,
2571 comment => 'more ignored stuff',
2573 { is_comment => TRUE,
2576 comment => 'and yet more',
2586 passed => [ 1 .. 4 ],
2587 actual_passed => [ 1 .. 4 ],
2589 actual_failed => [],
2594 is_good_plan => TRUE,
2604 junk_before_plan => {
2606 { is_unknown => TRUE,
2607 raw => 'this is junk',
2609 { is_comment => TRUE,
2610 comment => "this is a comment",
2618 { actual_passed => TRUE,
2619 is_actual_ok => TRUE,
2629 passed => [ 1 .. 1 ],
2630 actual_passed => [ 1 .. 1 ],
2632 actual_failed => [],
2637 is_good_plan => TRUE,
2647 { is_version => TRUE,
2648 raw => 'TAP version 13',
2656 { actual_passed => TRUE,
2657 is_actual_ok => TRUE,
2666 { actual_passed => TRUE,
2667 is_actual_ok => TRUE,
2676 { actual_passed => TRUE,
2677 is_actual_ok => TRUE,
2686 { actual_passed => TRUE,
2687 is_actual_ok => TRUE,
2696 { actual_passed => TRUE,
2697 is_actual_ok => TRUE,
2708 passed => [ 1 .. 5 ],
2709 actual_passed => [ 1 .. 5 ],
2711 actual_failed => [],
2716 is_good_plan => TRUE,
2726 { is_version => TRUE,
2727 raw => 'TAP version 12',
2735 { actual_passed => TRUE,
2736 is_actual_ok => TRUE,
2745 { actual_passed => TRUE,
2746 is_actual_ok => TRUE,
2755 { actual_passed => TRUE,
2756 is_actual_ok => TRUE,
2765 { actual_passed => TRUE,
2766 is_actual_ok => TRUE,
2775 { actual_passed => TRUE,
2776 is_actual_ok => TRUE,
2787 passed => [ 1 .. 5 ],
2788 actual_passed => [ 1 .. 5 ],
2790 actual_failed => [],
2795 is_good_plan => TRUE,
2799 ['Explicit TAP version must be at least 13. Got version 12'],
2812 { is_version => TRUE,
2813 raw => 'TAP version 13',
2815 { actual_passed => TRUE,
2816 is_actual_ok => TRUE,
2825 { actual_passed => TRUE,
2826 is_actual_ok => TRUE,
2835 { actual_passed => TRUE,
2836 is_actual_ok => TRUE,
2845 { actual_passed => TRUE,
2846 is_actual_ok => TRUE,
2855 { actual_passed => TRUE,
2856 is_actual_ok => TRUE,
2867 passed => [ 1 .. 5 ],
2868 actual_passed => [ 1 .. 5 ],
2870 actual_failed => [],
2875 is_good_plan => TRUE,
2879 ['If TAP version is present it must be the first line of output'],
2893 { actual_passed => TRUE,
2894 is_actual_ok => TRUE,
2896 'Should parse as literal backslash --> \\',
2903 is_unplanned => FALSE,
2905 { actual_passed => TRUE,
2906 is_actual_ok => TRUE,
2913 description => 'Not a continuation line',
2914 is_unplanned => FALSE,
2918 passed => [ 1 .. 2 ],
2919 actual_passed => [ 1 .. 2 ],
2921 actual_failed => [],
2926 is_good_plan => TRUE,
2943 { actual_passed => TRUE,
2944 is_actual_ok => TRUE,
2945 description => 'Not a \\# TODO',
2952 is_unplanned => FALSE,
2954 { actual_passed => TRUE,
2955 is_actual_ok => TRUE,
2962 description => 'Not a \\# SKIP',
2963 is_unplanned => FALSE,
2965 { actual_passed => TRUE,
2966 is_actual_ok => TRUE,
2973 description => 'Escaped \\\\\\#',
2974 is_unplanned => FALSE,
2978 passed => [ 1 .. 3 ],
2979 actual_passed => [ 1 .. 3 ],
2981 actual_failed => [],
2986 is_good_plan => TRUE,
2997 NOT_ZERO, sub { local $^W; 0 != shift },
2998 TRUE, sub { local $^W; !!shift },
2999 FALSE, sub { local $^W; !shift },
3002 my $can_open3 = ( $Config{d_fork} || $IsWin32 ) ? 1 : 0;
3004 for my $hide_fork ( 0 .. $can_open3 ) {
3008 *{'TAP::Parser::Iterator::Process::_use_open3'} = sub {return};
3012 for my $test ( sort keys %samples ) {
3014 #next unless 'empty' eq $test;
3015 my %details = %{ $samples{$test} };
3017 if ( my $skip_if = delete $details{skip_if} ) {
3018 next TEST if $skip_if->();
3021 my $results = delete $details{results};
3022 my $args = delete $details{__ARGS__};
3023 my $need_open3 = delete $details{need_open3};
3025 next TEST if $need_open3 && ( $hide_fork || !$can_open3 );
3027 # the following acrobatics are necessary to make it easy for the
3028 # Test::Builder::failure_output() method to be overridden when
3029 # TAP::Parser is not installed. Otherwise, these tests will fail.
3030 unshift @{ $args->{switches} }, '-It/lib';
3032 $args->{source} = File::Spec->catfile( $SAMPLE_TESTS, $test );
3033 $args->{merge} = !$hide_fork;
3035 my $parser = eval { analyze_test( $test, [@$results], $args ) };
3037 ok !$error, "'$test' should parse successfully" or diag $error;
3041 while ( my ( $method, $answer ) = each %details ) {
3042 $tests += ref $answer ? 2 : 1;
3045 skip "$test did not parse successfully", $tests;
3049 while ( my ( $method, $answer ) = each %details ) {
3050 if ( my $handler = $HANDLER_FOR{ $answer || '' } ) { # yuck
3051 ok $handler->( $parser->$method() ),
3052 "... and $method should return a reasonable value ($test)";
3054 elsif ( !ref $answer ) {
3055 local $^W; # uninit warnings
3057 $answer = _vmsify_answer( $method, $answer );
3059 is $parser->$method(), $answer,
3060 "... and $method should equal $answer ($test)";
3063 is scalar $parser->$method(), scalar @$answer,
3064 "... and $method should be the correct amount ($test)";
3065 is_deeply [ $parser->$method() ], $answer,
3066 "... and $method should be the correct values ($test)";
3073 my %Unix2VMS_Exit_Codes = (
3077 sub _vmsify_answer {
3078 my ( $method, $answer ) = @_;
3080 return $answer unless $IsVMS;
3082 if ( $method eq 'exit'
3083 and exists $Unix2VMS_Exit_Codes{$answer} )
3085 $answer = $Unix2VMS_Exit_Codes{$answer};
3092 my ( $test, $results, $args ) = @_;
3094 my $parser = TAP::Parser->new($args);
3096 while ( defined( my $result = $parser->next ) ) {
3098 my $expected = shift @$results;
3101 ? $result->description
3103 $desc = $result->plan if $result->is_plan && $desc =~ /SKIP/i;
3104 $desc =~ s/#/<hash>/g;
3105 $desc =~ s/\s+/ /g; # Drop newlines
3106 ok defined $expected,
3107 "$test/$count We should have a result for $desc";
3108 while ( my ( $method, $answer ) = each %$expected ) {
3110 if ( my $handler = $HANDLER_FOR{ $answer || '' } ) { # yuck
3111 ok $handler->( $result->$method() ),
3112 "... and $method should return a reasonable value ($test/$count)";
3114 elsif ( ref $answer ) {
3115 is_deeply $result->$method(), $answer,
3116 "... and $method should return the correct structure ($test/$count)";
3119 is $result->$method(), $answer,
3120 "... and $method should return the correct answer ($test/$count)";
3126 "... and we should have the correct number of results ($test)";