summaryrefslogtreecommitdiff
path: root/cpan/HTTP-Tiny/t/00-compile.t
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/HTTP-Tiny/t/00-compile.t')
-rw-r--r--cpan/HTTP-Tiny/t/00-compile.t22
1 files changed, 18 insertions, 4 deletions
diff --git a/cpan/HTTP-Tiny/t/00-compile.t b/cpan/HTTP-Tiny/t/00-compile.t
index 6ce3690f2f..698768633c 100644
--- a/cpan/HTTP-Tiny/t/00-compile.t
+++ b/cpan/HTTP-Tiny/t/00-compile.t
@@ -24,19 +24,33 @@ find(
'lib',
);
-my @scripts;
-if ( -d 'bin' ) {
+sub _find_scripts {
+ my $dir = shift @_;
+
+ my @found_scripts = ();
find(
sub {
return unless -f;
my $found = $File::Find::name;
# nothing to skip
- push @scripts, $found;
+ open my $FH, '<', $_ or do {
+ note( "Unable to open $found in ( $! ), skipping" );
+ return;
+ };
+ my $shebang = <$FH>;
+ return unless $shebang =~ /^#!.*?\bperl\b\s*$/;
+ push @found_scripts, $found;
},
- 'bin',
+ $dir,
);
+
+ return @found_scripts;
}
+my @scripts;
+do { push @scripts, _find_scripts($_) if -d $_ }
+ for qw{ bin script scripts };
+
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");