fix versionsync test

This commit is contained in:
Oliver Gorwits
2018-01-28 20:00:04 +00:00
parent c8eff78d34
commit e2713fb57a

View File

@@ -14,19 +14,19 @@ plan skip_all => "File::Slurp required for testing version sync"
plan qw(no_plan); plan qw(no_plan);
my $last_version = undef; my $last_version = undef;
find({wanted => \&check_version, no_chdir => 1}, 'blib'); find({wanted => \&check_version, no_chdir => 1}, 'lib');
if (! defined $last_version) { if (! defined $last_version) {
fail('Failed to find any files with $VERSION'); fail('Failed to find any files with $VERSION');
} }
sub check_version { sub check_version {
# $_ is the full path to the file # $_ is the full path to the file
return if (! m{blib/script/}xms && ! m{\.pm \z}xms); return if (! m{contrib/util/}xms && ! m{\.pm \z}xms);
my $content = read_file($_); my $content = read_file($_);
# only look at perl scripts, not sh scripts # only look at perl scripts, not sh scripts
return if (m{blib/script/}xms && $content !~ m/\A \#![^\r\n]+?perl/xms); return if (m{contrib/util/}xms && $content !~ m/\A \#![^\r\n]+?perl/xms);
my @version_lines = $content =~ m/ ( [^\n]* \$VERSION\s= [^\n]* ) /gxms; my @version_lines = $content =~ m/ ( [^\n]* \$VERSION\s= [^\n]* ) /gxms;
if (@version_lines == 0) { if (@version_lines == 0) {