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).
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19442
dcc99617-32d9-48b4-a31d-
7c20da2025e4
use warnings;
use Data::Dumper;
use Test::More 'no_plan';
+use File::Basename qw(dirname);
use MARC::Record;
use OpenILS::Utils::MFHD;
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);