[open-ils-commits] r19568 - branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 3 01:04:28 EST 2011
Author: dbs
Date: 2011-03-03 01:04:25 -0500 (Thu, 03 Mar 2011)
New Revision: 19568
Modified:
branches/rel_2_1/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: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t 2011-03-03 06:01:58 UTC (rev 19567)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t 2011-03-03 06:04:25 UTC (rev 19568)
@@ -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