]> eyrie.org Git - kerberos/wallet.git/commitdiff
Adjust perl/module-version-t to run from tests
authorRuss Allbery <eagle@eyrie.org>
Sun, 17 Jan 2016 20:38:45 +0000 (12:38 -0800)
committerRuss Allbery <eagle@eyrie.org>
Sun, 17 Jan 2016 20:38:45 +0000 (12:38 -0800)
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

index a9ebf3b7da0dace4a28486eb7c777c048810a260..47c22fee2c30ec261871952e1b07952735388edd 100755 (executable)
@@ -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)