[open-ils-commits] r19442 - trunk/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 14 02:22:15 EST 2011


Author: dbs
Date: 2011-02-14 02:22:11 -0500 (Mon, 14 Feb 2011)
New Revision: 19442

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t
Log:
Enable MFHD tests to find their testdata

When the MFHD tests wrapped in mfhd.t are invoked from outside of the directory,
they tests failed to find the mfhddata.txt file. Judicious use of the __FILE__
special literal and File::Basename::dirname() avoids that problem. Now we just
need to munge @INC to ensure that testlib.pm can be resolved (and hope that
no conflicts ever turn up).


Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t	2011-02-13 03:19:36 UTC (rev 19441)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t	2011-02-14 07:22:11 UTC (rev 19442)
@@ -4,6 +4,7 @@
 use warnings;
 use Data::Dumper;
 use Test::More 'no_plan';
+use File::Basename qw(dirname);
 
 use MARC::Record;
 use OpenILS::Utils::MFHD;
@@ -30,7 +31,8 @@
 my $rec;
 my @captions;
 
-open(my $testdata, "<mfhddata.txt") or die("Cannot open 'mfhddata.txt': $!");
+my $testfile = dirname(__FILE__) . "/mfhddata.txt";
+open(my $testdata, "<", $testfile) or die("Cannot open '$testfile': $!");
 
 while ($rec = testlib::load_MARC_rec($testdata, $testno++)) {
     $rec = MFHD->new($rec);



More information about the open-ils-commits mailing list