4 if ( $ENV{PERL_CORE} ) {
15 use Test::More 'no_plan';
20 use constant TRUE => "__TRUE__";
21 use constant FALSE => "__FALSE__";
23 # if wait() is non-zero, we cannot reliably predict its value
24 use constant NOT_ZERO => "__NOT_ZERO__";
28 my $IsVMS = $^O eq 'VMS';
29 my $IsWin32 = $^O eq 'MSWin32';
31 my $SAMPLE_TESTS = File::Spec->catdir(
34 ? ( File::Spec->updir(), 'ext', 'Test', 'Harness' )
41 my %deprecated = map { $_ => 1 } qw(
42 TAP::Parser::good_plan
43 TAP::Parser::Result::Plan::passed
44 TAP::Parser::Result::Test::passed
45 TAP::Parser::Result::Test::actual_passed
46 TAP::Parser::Result::passed
48 $SIG{__WARN__} = sub {
49 if ( $_[0] =~ /is deprecated/ ) {
50 my @caller = caller(1);
52 ok exists $deprecated{$sub},
53 "... we should get a deprecated warning for $sub";
60 # the %samples keys are the names of test scripts in t/sample-tests
70 { actual_passed => TRUE,
72 description => "Interlock activated",
79 is_unplanned => FALSE,
81 { actual_passed => TRUE,
89 description => "Megathrusters are go",
90 is_unplanned => FALSE,
92 { actual_passed => TRUE,
100 description => "Head formed",
101 is_unplanned => FALSE,
103 { actual_passed => TRUE,
104 is_actual_ok => TRUE,
111 description => "Blazing sword formed",
112 is_unplanned => FALSE,
114 { actual_passed => TRUE,
115 is_actual_ok => TRUE,
122 description => "Robeast destroyed",
123 is_unplanned => FALSE,
127 passed => [ 1 .. 5 ],
128 actual_passed => [ 1 .. 5 ],
135 is_good_plan => TRUE,
143 descriptive_trailing => {
145 { actual_passed => TRUE,
146 is_actual_ok => TRUE,
147 description => "Interlock activated",
154 is_unplanned => FALSE,
156 { actual_passed => TRUE,
157 is_actual_ok => TRUE,
164 description => "Megathrusters are go",
165 is_unplanned => FALSE,
167 { actual_passed => TRUE,
168 is_actual_ok => TRUE,
175 description => "Head formed",
176 is_unplanned => FALSE,
178 { actual_passed => TRUE,
179 is_actual_ok => TRUE,
186 description => "Blazing sword formed",
187 is_unplanned => FALSE,
189 { actual_passed => TRUE,
190 is_actual_ok => TRUE,
197 description => "Robeast destroyed",
198 is_unplanned => FALSE,
208 passed => [ 1 .. 5 ],
209 actual_passed => [ 1 .. 5 ],
216 is_good_plan => TRUE,
235 is_good_plan => FALSE,
236 tests_planned => undef,
238 parse_errors => ['No plan found in TAP output'],
251 { actual_passed => TRUE,
252 is_actual_ok => TRUE,
261 { actual_passed => TRUE,
262 is_actual_ok => TRUE,
271 { actual_passed => TRUE,
272 is_actual_ok => TRUE,
281 { actual_passed => TRUE,
282 is_actual_ok => TRUE,
291 { actual_passed => TRUE,
292 is_actual_ok => TRUE,
303 passed => [ 1 .. 5 ],
304 actual_passed => [ 1 .. 5 ],
311 is_good_plan => TRUE,
319 space_after_plan => {
327 { actual_passed => TRUE,
328 is_actual_ok => TRUE,
337 { actual_passed => TRUE,
338 is_actual_ok => TRUE,
347 { actual_passed => TRUE,
348 is_actual_ok => TRUE,
357 { actual_passed => TRUE,
358 is_actual_ok => TRUE,
367 { actual_passed => TRUE,
368 is_actual_ok => TRUE,
379 passed => [ 1 .. 5 ],
380 actual_passed => [ 1 .. 5 ],
387 is_good_plan => TRUE,
397 { is_version => TRUE,
398 raw => 'TAP version 13',
406 { actual_passed => TRUE,
407 is_actual_ok => TRUE,
416 { actual_passed => TRUE,
417 is_actual_ok => TRUE,
428 { 'fnurk' => 'skib', 'ponk' => 'gleeb' },
429 { 'bar' => 'krup', 'foo' => 'plink' }
432 " ---\n -\n fnurk: skib\n ponk: gleeb\n -\n bar: krup\n foo: plink\n ...",
434 { actual_passed => TRUE,
435 is_actual_ok => TRUE,
444 { actual_passed => TRUE,
445 is_actual_ok => TRUE,
456 'got' => [ '1', 'pong', '4' ],
457 'expected' => [ '1', '2', '4' ]
460 " ---\n expected:\n - 1\n - 2\n - 4\n got:\n - 1\n - pong\n - 4\n ...",
462 { actual_passed => TRUE,
463 is_actual_ok => TRUE,
474 passed => [ 1 .. 5 ],
475 actual_passed => [ 1 .. 5 ],
482 is_good_plan => TRUE,
498 { actual_passed => TRUE,
499 is_actual_ok => TRUE,
508 { actual_passed => FALSE,
509 is_actual_ok => FALSE,
518 { actual_passed => TRUE,
519 is_actual_ok => TRUE,
528 { actual_passed => TRUE,
529 is_actual_ok => TRUE,
538 { actual_passed => FALSE,
539 is_actual_ok => FALSE,
550 passed => [ 1, 3, 4 ],
551 actual_passed => [ 1, 3, 4 ],
553 actual_failed => [ 2, 5 ],
558 is_good_plan => TRUE,
574 { actual_passed => TRUE,
575 is_actual_ok => TRUE,
584 { actual_passed => TRUE,
585 is_actual_ok => TRUE,
593 explanation => 'rain delay',
595 { actual_passed => TRUE,
596 is_actual_ok => TRUE,
605 { actual_passed => TRUE,
606 is_actual_ok => TRUE,
615 { actual_passed => TRUE,
616 is_actual_ok => TRUE,
627 passed => [ 1 .. 5 ],
628 actual_passed => [ 1 .. 5 ],
635 is_good_plan => TRUE,
651 { actual_passed => TRUE,
652 is_actual_ok => TRUE,
665 actual_passed => [1],
672 is_good_plan => TRUE,
688 { actual_passed => FALSE,
689 is_actual_ok => FALSE,
696 description => "- Foo",
697 explanation => 'Just testing the todo interface.',
699 { actual_passed => TRUE,
700 is_actual_ok => TRUE,
707 description => "- Unexpected success",
708 explanation => 'Just testing the todo interface.',
710 { actual_passed => TRUE,
711 is_actual_ok => TRUE,
718 description => "- This is not todo",
723 passed => [ 1, 2, 3 ],
724 actual_passed => [ 2, 3 ],
726 actual_failed => [1],
731 is_good_plan => TRUE,
744 raw => '1..5 todo 3 2;',
746 todo_list => [ 3, 2 ],
748 { actual_passed => TRUE,
749 is_actual_ok => TRUE,
759 { actual_passed => TRUE,
760 is_actual_ok => TRUE,
770 { actual_passed => FALSE,
771 is_actual_ok => FALSE,
781 { actual_passed => TRUE,
782 is_actual_ok => TRUE,
792 { actual_passed => TRUE,
793 is_actual_ok => TRUE,
805 passed => [ 1, 2, 3, 4, 5 ],
806 actual_passed => [ 1, 2, 4, 5 ],
808 actual_failed => [3],
813 is_good_plan => TRUE,
829 { actual_passed => TRUE,
830 is_actual_ok => TRUE,
839 is_unplanned => FALSE,
841 { actual_passed => TRUE,
842 is_actual_ok => TRUE,
851 is_unplanned => FALSE,
853 { actual_passed => TRUE,
854 is_actual_ok => TRUE,
863 is_unplanned => FALSE,
865 { actual_passed => TRUE,
866 is_actual_ok => TRUE,
875 is_unplanned => FALSE,
877 { actual_passed => TRUE,
878 is_actual_ok => TRUE,
887 is_unplanned => FALSE,
889 { actual_passed => TRUE,
890 is_actual_ok => TRUE,
899 is_unplanned => FALSE,
901 { actual_passed => TRUE,
902 is_actual_ok => TRUE,
911 is_unplanned => FALSE,
913 { actual_passed => TRUE,
914 is_actual_ok => TRUE,
923 is_unplanned => FALSE,
925 { actual_passed => TRUE,
926 is_actual_ok => TRUE,
935 is_unplanned => FALSE,
937 { actual_passed => TRUE,
938 is_actual_ok => TRUE,
947 is_unplanned => FALSE,
949 { actual_passed => TRUE,
950 is_actual_ok => TRUE,
959 is_unplanned => TRUE,
963 passed => [ 1 .. 4, 4 .. 9 ],
964 actual_passed => [ 1 .. 4, 4 .. 10 ],
974 'Tests out of sequence. Found (4) but expected (5)',
975 'Tests out of sequence. Found (5) but expected (6)',
976 'Tests out of sequence. Found (6) but expected (7)',
977 'Tests out of sequence. Found (7) but expected (8)',
978 'Tests out of sequence. Found (8) but expected (9)',
979 'Tests out of sequence. Found (9) but expected (10)',
980 'Tests out of sequence. Found (10) but expected (11)',
981 'Bad plan. You planned 10 tests but ran 11.',
994 { actual_passed => TRUE,
995 is_actual_ok => TRUE,
1004 { actual_passed => TRUE,
1005 is_actual_ok => TRUE,
1014 { actual_passed => FALSE,
1015 is_actual_ok => FALSE,
1024 { actual_passed => TRUE,
1025 is_actual_ok => TRUE,
1034 { actual_passed => TRUE,
1035 is_actual_ok => TRUE,
1046 passed => [ 1, 2, 4, 5 ],
1047 actual_passed => [ 1, 2, 4, 5 ],
1049 actual_failed => [3],
1054 is_good_plan => TRUE,
1070 { actual_passed => TRUE,
1071 is_actual_ok => TRUE,
1080 { actual_passed => TRUE,
1081 is_actual_ok => TRUE,
1090 { actual_passed => TRUE,
1091 is_actual_ok => TRUE,
1100 { is_bailout => TRUE,
1101 explanation => "GERONIMMMOOOOOO!!!",
1103 { actual_passed => TRUE,
1104 is_actual_ok => TRUE,
1113 { actual_passed => TRUE,
1114 is_actual_ok => TRUE,
1125 passed => [ 1 .. 5 ],
1126 actual_passed => [ 1 .. 5 ],
1128 actual_failed => [],
1133 is_good_plan => TRUE,
1145 actual_passed => [],
1147 actual_failed => [],
1152 tests_planned => undef,
1154 parse_errors => [ 'No plan found in TAP output', ],
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 => FALSE,
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,
1232 { actual_passed => TRUE,
1233 is_actual_ok => TRUE,
1241 is_unplanned => TRUE,
1245 passed => [ 1 .. 3 ],
1246 actual_passed => [ 1 .. 7 ],
1247 failed => [ 4 .. 7 ],
1248 actual_failed => [],
1255 parse_errors => ['Bad plan. You planned 3 tests but ran 7.'],
1258 skip_if => sub {$IsVMS},
1266 tests_planned => TRUE,
1268 { actual_passed => TRUE,
1269 is_actual_ok => TRUE,
1270 description => "- -T honored",
1280 passed => [ 1 .. 1 ],
1281 actual_passed => [ 1 .. 1 ],
1283 actual_failed => [],
1288 is_good_plan => TRUE,
1289 tests_planned => TRUE,
1300 actual_passed => [],
1302 actual_failed => [],
1307 tests_planned => undef,
1309 parse_errors => [ 'No plan found in TAP output', ],
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,
1348 { actual_passed => TRUE,
1349 is_actual_ok => TRUE,
1361 passed => [ 1 .. 4 ],
1362 actual_passed => [ 1 .. 4 ],
1364 actual_failed => [],
1369 tests_planned => undef,
1371 parse_errors => [ 'No plan found in TAP output', ],
1375 die_last_minute => {
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,
1410 { actual_passed => TRUE,
1411 is_actual_ok => TRUE,
1429 passed => [ 1 .. 4 ],
1430 actual_passed => [ 1 .. 4 ],
1432 actual_failed => [],
1437 is_good_plan => TRUE,
1452 { actual_passed => TRUE,
1453 is_actual_ok => TRUE,
1463 { actual_passed => TRUE,
1464 is_actual_ok => TRUE,
1474 { actual_passed => TRUE,
1475 is_actual_ok => TRUE,
1481 number => 136211425,
1485 { actual_passed => TRUE,
1486 is_actual_ok => TRUE,
1492 number => 136211426,
1499 actual_passed => [ 1, 2, 136211425, 136211426 ],
1500 failed => [ 136211425, 136211426 ],
1501 actual_failed => [],
1509 'Tests out of sequence. Found (136211425) but expected (3)',
1510 'Tests out of sequence. Found (136211426) but expected (4)',
1511 'Bad plan. You planned 2 tests but ran 4.'
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,
1634 { actual_passed => TRUE,
1635 is_actual_ok => TRUE,
1648 actual_passed => [ 1, 2, 99997 .. 100005 ],
1649 failed => [ 99997 .. 100005 ],
1650 actual_failed => [],
1658 'Tests out of sequence. Found (99997) but expected (3)',
1659 'Tests out of sequence. Found (99998) but expected (4)',
1660 'Tests out of sequence. Found (99999) but expected (5)',
1661 'Tests out of sequence. Found (100000) but expected (6)',
1662 'Tests out of sequence. Found (100001) but expected (7)',
1663 'Tests out of sequence. Found (100002) but expected (8)',
1664 'Tests out of sequence. Found (100003) but expected (9)',
1665 'Tests out of sequence. Found (100004) but expected (10)',
1666 'Tests out of sequence. Found (100005) but expected (11)',
1667 'Bad plan. You planned 2 tests but ran 11.'
1678 tests_planned => 10,
1680 { actual_passed => TRUE,
1681 is_actual_ok => TRUE,
1691 { actual_passed => TRUE,
1692 is_actual_ok => TRUE,
1699 description => 'basset hounds got long ears',
1702 { actual_passed => FALSE,
1703 is_actual_ok => FALSE,
1710 description => 'all hell broke loose',
1713 { actual_passed => FALSE,
1714 is_actual_ok => FALSE,
1722 explanation => 'if I heard a voice from heaven ...',
1724 { actual_passed => TRUE,
1725 is_actual_ok => TRUE,
1732 description => 'say "live without loving",',
1735 { actual_passed => TRUE,
1736 is_actual_ok => TRUE,
1743 description => "I'd beg off.",
1746 { actual_passed => TRUE,
1747 is_actual_ok => TRUE,
1755 explanation => 'contract negotiations',
1757 { actual_passed => TRUE,
1758 is_actual_ok => TRUE,
1765 description => 'Girls are such exquisite hell',
1768 { actual_passed => TRUE,
1769 is_actual_ok => TRUE,
1776 description => 'Elegy 9B',
1779 { actual_passed => FALSE,
1780 is_actual_ok => FALSE,
1792 passed => [ 1 .. 2, 4 .. 9 ],
1793 actual_passed => [ 1 .. 2, 5 .. 9 ],
1794 failed => [ 3, 10 ],
1795 actual_failed => [ 3, 4, 10 ],
1800 is_good_plan => TRUE,
1801 tests_planned => 10,
1810 { is_comment => TRUE,
1813 comment => 'comments',
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 { actual_passed => TRUE,
1849 is_actual_ok => TRUE,
1859 { is_comment => TRUE,
1862 comment => 'comment',
1870 { is_comment => TRUE,
1873 comment => 'more ignored stuff',
1875 { is_comment => TRUE,
1878 comment => 'and yet more',
1882 passed => [ 1 .. 4 ],
1883 actual_passed => [ 1 .. 4 ],
1885 actual_failed => [],
1890 is_good_plan => TRUE,
1900 { is_comment => TRUE,
1903 comment => 'comments',
1905 { actual_passed => TRUE,
1906 is_actual_ok => TRUE,
1916 { actual_passed => FALSE,
1917 is_actual_ok => FALSE,
1927 { actual_passed => TRUE,
1928 is_actual_ok => TRUE,
1938 { actual_passed => TRUE,
1939 is_actual_ok => TRUE,
1949 { is_comment => TRUE,
1952 comment => 'comment',
1960 { is_comment => TRUE,
1963 comment => 'more ignored stuff',
1965 { is_comment => TRUE,
1968 comment => 'and yet more',
1972 passed => [ 1, 3, 4 ],
1973 actual_passed => [ 1, 3, 4 ],
1975 actual_failed => [2],
1980 is_good_plan => TRUE,
1990 { actual_passed => TRUE,
1991 is_actual_ok => TRUE,
1998 description => '- Test that argument passing works',
2001 { actual_passed => TRUE,
2002 is_actual_ok => TRUE,
2010 '- Test that passing arguments as references work',
2013 { actual_passed => TRUE,
2014 is_actual_ok => TRUE,
2021 description => '- Test a normal sub',
2024 { actual_passed => TRUE,
2025 is_actual_ok => TRUE,
2032 description => '- Detach 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 => '- Nested thread test',
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 7, got 7',
2079 { actual_passed => TRUE,
2080 is_actual_ok => TRUE,
2087 description => '- Wanted 8, got 8',
2090 { actual_passed => TRUE,
2091 is_actual_ok => TRUE,
2098 description => '- Wanted 8, got 8',
2105 tests_planned => 15,
2107 { actual_passed => TRUE,
2108 is_actual_ok => TRUE,
2118 { actual_passed => TRUE,
2119 is_actual_ok => TRUE,
2126 description => '- Check that Config::threads is true',
2129 { actual_passed => TRUE,
2130 is_actual_ok => TRUE,
2137 description => '- Detach test',
2140 { actual_passed => TRUE,
2141 is_actual_ok => TRUE,
2149 '- Check so that tid for threads work for main thread',
2152 { actual_passed => TRUE,
2153 is_actual_ok => TRUE,
2161 '- Check so that tid for threads work for main thread',
2166 passed => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2167 actual_passed => [ 2 .. 4, 6, 8 .. 13, 1, 5, 7, 14, 15 ],
2169 actual_failed => [],
2173 is_good_plan => FALSE,
2174 tests_planned => 15,
2177 # Note that tests 14 and 15 *are* in the correct sequence.
2179 'Tests out of sequence. Found (2) but expected (1)',
2180 'Tests out of sequence. Found (3) but expected (2)',
2181 'Tests out of sequence. Found (4) but expected (3)',
2182 'Tests out of sequence. Found (6) but expected (4)',
2183 'Tests out of sequence. Found (8) but expected (5)',
2184 'Tests out of sequence. Found (9) but expected (6)',
2185 'Tests out of sequence. Found (10) but expected (7)',
2186 'Tests out of sequence. Found (11) but expected (8)',
2187 'Tests out of sequence. Found (12) but expected (9)',
2188 'Tests out of sequence. Found (13) but expected (10)',
2189 'Plan (1..15) must be at the beginning or end of the TAP output',
2190 'Tests out of sequence. Found (1) but expected (11)',
2191 'Tests out of sequence. Found (5) but expected (12)',
2192 'Tests out of sequence. Found (7) but expected (13)',
2200 raw => '1..0 # skipping: rope',
2204 directive => 'SKIP',
2210 actual_passed => [],
2212 actual_failed => [],
2217 is_good_plan => TRUE,
2224 skip_all => '(no reason given)',
2228 { is_version => TRUE,
2229 raw => 'TAP version 13',
2231 { is_unknown => TRUE,
2232 raw => '1..0 # skipping: rope',
2237 actual_passed => [],
2239 actual_failed => [],
2244 is_good_plan => FALSE,
2245 tests_planned => FALSE,
2247 parse_errors => ['No plan found in TAP output'],
2254 { is_version => TRUE,
2255 raw => 'TAP version 13',
2260 { is_pragma => TRUE,
2261 raw => 'pragma +strict',
2262 pragmas => ['+strict'],
2264 { is_unknown => TRUE, raw => 'Nonsense!',
2266 { is_pragma => TRUE,
2267 raw => 'pragma -strict',
2268 pragmas => ['-strict'],
2270 { is_unknown => TRUE,
2271 raw => "Doesn't matter.",
2274 raw => 'ok 1 All OK',
2279 actual_passed => [1],
2281 actual_failed => [],
2286 is_good_plan => TRUE,
2289 parse_errors => ['Unknown TAP token: "Nonsense!"'],
2290 'exit' => 0, # TODO: Is this right???
2301 directive => 'SKIP',
2307 actual_passed => [],
2309 actual_failed => [],
2314 is_good_plan => TRUE,
2321 skip_all => '(no reason given)',
2327 tests_planned => TRUE,
2331 { actual_passed => FALSE,
2332 is_actual_ok => FALSE,
2339 description => 'Hamlette # TODOORNOTTODO',
2345 actual_passed => [],
2347 actual_failed => [1],
2352 is_good_plan => TRUE,
2353 tests_planned => TRUE,
2360 shbang_misparse => {
2368 { actual_passed => TRUE,
2369 is_actual_ok => TRUE,
2378 { actual_passed => TRUE,
2379 is_actual_ok => TRUE,
2390 passed => [ 1 .. 2 ],
2391 actual_passed => [ 1 .. 2 ],
2393 actual_failed => [],
2398 is_good_plan => TRUE,
2414 { actual_passed => TRUE,
2415 is_actual_ok => TRUE,
2426 __ARGS__ => { switches => ['-Mstrict'] },
2429 actual_passed => [1],
2431 actual_failed => [],
2436 is_good_plan => TRUE,
2452 { actual_passed => TRUE,
2453 is_actual_ok => TRUE,
2464 __ARGS__ => { switches => ['-Iexamples'] },
2467 actual_passed => [1],
2469 actual_failed => [],
2474 is_good_plan => TRUE,
2482 sequence_misparse => {
2490 { actual_passed => TRUE,
2491 is_actual_ok => TRUE,
2500 { actual_passed => TRUE,
2501 is_actual_ok => TRUE,
2510 { actual_passed => TRUE,
2511 is_actual_ok => TRUE,
2518 description => "\# skipped on foobar system",
2520 { is_comment => TRUE,
2521 comment => '1234567890123456789012345678901234567890',
2523 { actual_passed => TRUE,
2524 is_actual_ok => TRUE,
2533 { is_comment => TRUE,
2534 comment => '1234567890123456789012345678901234567890',
2536 { actual_passed => TRUE,
2537 is_actual_ok => TRUE,
2548 passed => [ 1 .. 5 ],
2549 actual_passed => [ 1 .. 5 ],
2551 actual_failed => [],
2556 is_good_plan => TRUE,
2567 { is_comment => TRUE,
2570 comment => 'comments',
2572 { actual_passed => TRUE,
2573 is_actual_ok => TRUE,
2583 { actual_passed => TRUE,
2584 is_actual_ok => TRUE,
2594 { actual_passed => TRUE,
2595 is_actual_ok => TRUE,
2605 { is_comment => TRUE,
2608 comment => 'comment',
2610 { actual_passed => TRUE,
2611 is_actual_ok => TRUE,
2621 { is_comment => TRUE,
2624 comment => 'more ignored stuff',
2626 { is_comment => TRUE,
2629 comment => 'and yet more',
2639 passed => [ 1 .. 4 ],
2640 actual_passed => [ 1 .. 4 ],
2642 actual_failed => [],
2647 is_good_plan => TRUE,
2657 junk_before_plan => {
2659 { is_unknown => TRUE,
2660 raw => 'this is junk',
2662 { is_comment => TRUE,
2663 comment => "this is a comment",
2671 { actual_passed => TRUE,
2672 is_actual_ok => TRUE,
2682 passed => [ 1 .. 1 ],
2683 actual_passed => [ 1 .. 1 ],
2685 actual_failed => [],
2690 is_good_plan => TRUE,
2700 { is_version => TRUE,
2701 raw => 'TAP version 13',
2709 { actual_passed => TRUE,
2710 is_actual_ok => TRUE,
2719 { actual_passed => TRUE,
2720 is_actual_ok => TRUE,
2729 { actual_passed => TRUE,
2730 is_actual_ok => TRUE,
2739 { actual_passed => TRUE,
2740 is_actual_ok => TRUE,
2749 { actual_passed => TRUE,
2750 is_actual_ok => TRUE,
2761 passed => [ 1 .. 5 ],
2762 actual_passed => [ 1 .. 5 ],
2764 actual_failed => [],
2769 is_good_plan => TRUE,
2779 { is_version => TRUE,
2780 raw => 'TAP version 12',
2788 { actual_passed => TRUE,
2789 is_actual_ok => TRUE,
2798 { actual_passed => TRUE,
2799 is_actual_ok => TRUE,
2808 { actual_passed => TRUE,
2809 is_actual_ok => TRUE,
2818 { actual_passed => TRUE,
2819 is_actual_ok => TRUE,
2828 { actual_passed => TRUE,
2829 is_actual_ok => TRUE,
2840 passed => [ 1 .. 5 ],
2841 actual_passed => [ 1 .. 5 ],
2843 actual_failed => [],
2848 is_good_plan => TRUE,
2852 ['Explicit TAP version must be at least 13. Got version 12'],
2865 { is_version => TRUE,
2866 raw => 'TAP version 13',
2868 { actual_passed => TRUE,
2869 is_actual_ok => TRUE,
2878 { actual_passed => TRUE,
2879 is_actual_ok => TRUE,
2888 { actual_passed => TRUE,
2889 is_actual_ok => TRUE,
2898 { actual_passed => TRUE,
2899 is_actual_ok => TRUE,
2908 { actual_passed => TRUE,
2909 is_actual_ok => TRUE,
2920 passed => [ 1 .. 5 ],
2921 actual_passed => [ 1 .. 5 ],
2923 actual_failed => [],
2928 is_good_plan => TRUE,
2932 ['If TAP version is present it must be the first line of output'],
2946 { actual_passed => TRUE,
2947 is_actual_ok => TRUE,
2949 'Should parse as literal backslash --> \\',
2956 is_unplanned => FALSE,
2958 { actual_passed => TRUE,
2959 is_actual_ok => TRUE,
2966 description => 'Not a continuation line',
2967 is_unplanned => FALSE,
2971 passed => [ 1 .. 2 ],
2972 actual_passed => [ 1 .. 2 ],
2974 actual_failed => [],
2979 is_good_plan => TRUE,
2996 { actual_passed => TRUE,
2997 is_actual_ok => TRUE,
2998 description => 'Not a \\# TODO',
3005 is_unplanned => FALSE,
3007 { actual_passed => TRUE,
3008 is_actual_ok => TRUE,
3015 description => 'Not a \\# SKIP',
3016 is_unplanned => FALSE,
3018 { actual_passed => TRUE,
3019 is_actual_ok => TRUE,
3026 description => 'Escaped \\\\\\#',
3027 is_unplanned => FALSE,
3031 passed => [ 1 .. 3 ],
3032 actual_passed => [ 1 .. 3 ],
3034 actual_failed => [],
3039 is_good_plan => TRUE,
3050 NOT_ZERO, sub { local $^W; 0 != shift },
3051 TRUE, sub { local $^W; !!shift },
3052 FALSE, sub { local $^W; !shift },
3055 my $can_open3 = ( $Config{d_fork} || $IsWin32 ) ? 1 : 0;
3057 for my $hide_fork ( 0 .. $can_open3 ) {
3061 *{'TAP::Parser::Iterator::Process::_use_open3'} = sub {return};
3065 for my $test ( sort keys %samples ) {
3067 #next unless 'empty' eq $test;
3068 my %details = %{ $samples{$test} };
3070 if ( my $skip_if = delete $details{skip_if} ) {
3071 next TEST if $skip_if->();
3074 my $results = delete $details{results};
3075 my $args = delete $details{__ARGS__};
3076 my $need_open3 = delete $details{need_open3};
3078 next TEST if $need_open3 && ( $hide_fork || !$can_open3 );
3080 # the following acrobatics are necessary to make it easy for the
3081 # Test::Builder::failure_output() method to be overridden when
3082 # TAP::Parser is not installed. Otherwise, these tests will fail.
3084 unshift @{ $args->{switches} },
3085 $ENV{PERL_CORE} ? ( map {"-I$_"} @INC ) : ('-It/lib');
3087 $args->{source} = File::Spec->catfile( $SAMPLE_TESTS, $test );
3088 $args->{merge} = !$hide_fork;
3090 my $parser = eval { analyze_test( $test, [@$results], $args ) };
3092 ok !$error, "'$test' should parse successfully"
3097 while ( my ( $method, $answer ) = each %details ) {
3098 $tests += ref $answer ? 2 : 1;
3101 skip "$test did not parse successfully", $tests;
3105 while ( my ( $method, $answer ) = each %details ) {
3106 if ( my $handler = $HANDLER_FOR{ $answer || '' } ) { # yuck
3107 ok $handler->( $parser->$method() ),
3108 "... and $method should return a reasonable value ($test)";
3110 elsif ( !ref $answer ) {
3111 local $^W; # uninit warnings
3113 $answer = _vmsify_answer( $method, $answer );
3115 is $parser->$method(), $answer,
3116 "... and $method should equal $answer ($test)";
3119 is scalar $parser->$method(), scalar @$answer,
3120 "... and $method should be the correct amount ($test)";
3121 is_deeply [ $parser->$method() ], $answer,
3122 "... and $method should be the correct values ($test)";
3129 my %Unix2VMS_Exit_Codes = ( 1 => 4, );
3131 sub _vmsify_answer {
3132 my ( $method, $answer ) = @_;
3134 return $answer unless $IsVMS;
3136 if ( $method eq 'exit'
3137 and exists $Unix2VMS_Exit_Codes{$answer} )
3139 $answer = $Unix2VMS_Exit_Codes{$answer};
3146 my ( $test, $results, $args ) = @_;
3148 my $parser = TAP::Parser->new($args);
3150 while ( defined( my $result = $parser->next ) ) {
3152 my $expected = shift @$results;
3155 ? $result->description
3157 $desc = $result->plan
3158 if $result->is_plan && $desc =~ /SKIP/i;
3159 $desc =~ s/#/<hash>/g;
3160 $desc =~ s/\s+/ /g; # Drop newlines
3161 ok defined $expected,
3162 "$test/$count We should have a result for $desc";
3163 while ( my ( $method, $answer ) = each %$expected ) {
3165 if ( my $handler = $HANDLER_FOR{ $answer || '' } ) { # yuck
3166 ok $handler->( $result->$method() ),
3167 "... and $method should return a reasonable value ($test/$count)";
3169 elsif ( ref $answer ) {
3170 is_deeply scalar( $result->$method() ), $answer,
3171 "... and $method should return the correct structure ($test/$count)";
3174 is $result->$method(), $answer,
3175 "... and $method should return the correct answer ($test/$count)";
3181 "... and we should have the correct number of results ($test)";