diff options
author | Karen Etheridge <ether@cpan.org> | 2016-01-03 11:05:17 -0800 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2016-01-03 14:46:00 -0500 |
commit | 849dc6836a2f0fc6c752421bfc04c26a8a939dc9 (patch) | |
tree | b5cbe187f34090d64944123ed74f1a54f8bad309 /cpan/podlators/t | |
parent | 398a990f4831b43774f3ef6405e1fa6d326d23a1 (diff) | |
download | perl-849dc6836a2f0fc6c752421bfc04c26a8a939dc9.tar.gz |
update podlators to 4.04
Diffstat (limited to 'cpan/podlators/t')
-rw-r--r-- | cpan/podlators/t/docs/synopsis.t | 16 | ||||
-rw-r--r-- | cpan/podlators/t/lib/Test/Podlators.pm | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cpan/podlators/t/docs/synopsis.t b/cpan/podlators/t/docs/synopsis.t index 3d5b44a20f..3cdcbab21c 100644 --- a/cpan/podlators/t/docs/synopsis.t +++ b/cpan/podlators/t/docs/synopsis.t @@ -33,6 +33,7 @@ use warnings; use lib 't/lib'; +use File::Spec; use Test::More; use Test::RRA qw(skip_unless_automated use_prereq); @@ -43,12 +44,25 @@ skip_unless_automated('Synopsis syntax tests'); use_prereq('Perl::Critic::Utils'); use_prereq('Test::Synopsis'); +# Helper function that checks to see if a given path starts with blib/script. +# This is written a bit weirdly so that it's portable to Windows and VMS. +# +# $path - Path to a file +# +# Returns: True if the file doesn't start with blib/script, false otherwise. +sub in_blib_script { + my ($path) = @_; + my ($volume, $dir, $file) = File::Spec->splitpath($path); + my @dir = File::Spec->splitdir($dir); + return (scalar(@dir) < 2 || $dir[0] ne 'blib' || $dir[1] ne 'script'); +} + # The default Test::Synopsis all_synopsis_ok() function requires that the # module be in a lib directory. Use Perl::Critic::Utils to find the modules # in blib, or lib if it doesn't exist. However, strip out anything in # blib/script, since scripts use a different SYNOPSIS syntax. my @files = Perl::Critic::Utils::all_perl_files('blib'); -@files = grep { !m{blib/script/}xms } @files; +@files = grep { in_blib_script($_) } @files; if (!@files) { @files = Perl::Critic::Utils::all_perl_files('lib'); } diff --git a/cpan/podlators/t/lib/Test/Podlators.pm b/cpan/podlators/t/lib/Test/Podlators.pm index 77945574ec..33bbb652a6 100644 --- a/cpan/podlators/t/lib/Test/Podlators.pm +++ b/cpan/podlators/t/lib/Test/Podlators.pm @@ -66,7 +66,7 @@ END { sub _stderr_save { my $tmpdir = File::Spec->catdir('t', 'tmp'); if (!-d $tmpdir) { - mkdir('t/tmp', 0777) or BAIL_OUT("cannot create t/tmp: $!"); + mkdir($tmpdir, 0777) or BAIL_OUT("cannot create $tmpdir: $!"); } my $path = File::Spec->catfile($tmpdir, "out$$.err"); @@ -309,7 +309,7 @@ sub test_snippet_with_io { # directive. my $tmpdir = File::Spec->catdir('t', 'tmp'); if (!-d $tmpdir) { - mkdir($tmpdir, 0777); + mkdir($tmpdir, 0777) or BAIL_OUT("cannot create $tmpdir: $!"); } my $input_file = File::Spec->catfile('t', 'tmp', "tmp$$.pod"); open(my $input, '>', $input_file) |