| 1 |
#!perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
use Test::More; |
| 6 |
use Test::Exception; |
| 7 |
use Catmandu::Importer::MARC; |
| 8 |
|
| 9 |
my $pkg; |
| 10 |
|
| 11 |
BEGIN { |
| 12 |
$pkg = 'Catmandu::Importer::MARC::Lint'; |
| 13 |
use_ok $pkg; |
| 14 |
} |
| 15 |
|
| 16 |
require_ok $pkg; |
| 17 |
|
| 18 |
my $importer = Catmandu::Importer::MARC->new( |
| 19 |
file => 't/camel.mrc', |
| 20 |
type => "Lint" |
| 21 |
); |
| 22 |
|
| 23 |
ok $importer , 'got an MARC/ISO importer'; |
| 24 |
|
| 25 |
my $records = $importer->to_array(); |
| 26 |
|
| 27 |
ok @$records == 10, 'got all records' ; |
| 28 |
is $records->[0]->{'_id'} , 'fol05731351 ', 'got _id' ; |
| 29 |
is $records->[0]->{'record'}->[1][-1] , 'fol05731351 ', 'got subfield' ; |
| 30 |
is $records->[0]->{'_id'} , $records->[0]->{'record'}->[1][-1], '_id matches record id' ; |
| 31 |
|
| 32 |
ok $records->[9]->{lint} , 'got lint'; |
| 33 |
|
| 34 |
done_testing; |