From 57bcc0cb1e8893f6a39c4fcb902d02b920efde1a Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 17 Jan 2016 12:38:45 -0800 Subject: Adjust perl/module-version-t to run from tests When run under runtests, it runs with a parent directory of tests, and therefore needs to look for NEWS in ../NEWS. Allow for both paths. --- tests/perl/module-version-t | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/perl/module-version-t b/tests/perl/module-version-t index a9ebf3b..47c22fe 100755 --- a/tests/perl/module-version-t +++ b/tests/perl/module-version-t @@ -37,8 +37,15 @@ use Test::RRA::ModuleVersion qw(test_module_versions update_module_versions); # List: The version number and the package name # Throws: Text exception if NEWS is not found or doesn't contain a version sub news_version { - my ($package, $version); - open(my $news, q{<}, 'NEWS') or die "$0: cannot open NEWS: $!\n"; + my ($package, $version, $news); + for my $path ('NEWS', '../NEWS') { + if (-f $path) { + open($news, q{<}, $path) or die "$0: cannot open $path: $!\n"; + } + } + if (!$news) { + die "$0: cannot find NEWS file\n"; + } SCAN: while (defined(my $line = <$news>)) { ## no critic (RegularExpressions::ProhibitEscapedMetacharacters) -- cgit v1.2.3