3 use Test::More qw(no_plan);
5 use File::Temp qw( tempdir tempfile );
7 my $perl = $^X || 'perl';
8 my $inc = join(' -I ', @INC) || '';
9 $inc = "-I $inc" if $inc;
11 # Test to check that bad Pod doesn't break subsequent files. Here the test is that
12 # both files should be detected as containing tabs, when tested one after the
17 make_bad_pod_file($dir);
18 make_bad_tab_file($dir);
19 my (undef, $outfile) = tempfile();
20 ok( `$perl $inc -MTest::NoTabs -e "all_perl_files_ok( '$dir' )" 2>&1 > $outfile` );
22 open my $fh, '<', $outfile or die $!;
25 # Filter the ok 1 line as we really don't care - it doesn't contain a tab anyway
26 $content =~ s{^ok 1[^\n]*\n}{}s;
28 like( $content, qr/^not ok 2 - No tabs in '[^']*' on line 4/m, 'tabs found in tmp file 2' );
30 system("rm -rf $dir");
33 sub make_bad_pod_file {
36 # First file, template begins "a"
37 my ($fh, $filename) = tempfile( "a_badpod_XXXXXX", DIR => $tmpdir, SUFFIX => '.pL' );
43 Some unterminated Pod documentation follows, otherwise the file is OK
49 sub make_bad_tab_file {
52 # Second file, template begins "b"
53 my ($fh, $filename) = tempfile( "b_badtab_podtest_XXXXXX", DIR => $tmpdir, SUFFIX => '.pL' );