3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Test::More tests => 20; |
use Test::More tests => 40; |
7 |
use Test::Exception; |
use Test::Exception; |
8 |
use Data::Dumper; |
use Data::Dump qw/dump/; |
9 |
|
|
10 |
BEGIN { use_ok( 'MARC::Fast' ); } |
BEGIN { use_ok( 'MARC::Fast' ); } |
11 |
|
|
12 |
|
my $debug = shift @ARGV; |
13 |
|
|
14 |
my $marc; |
my $marc; |
15 |
my %param; |
my %param; |
16 |
|
|
23 |
$param{marcdb} = 'data/unimarc.iso'; |
$param{marcdb} = 'data/unimarc.iso'; |
24 |
|
|
25 |
SKIP: { |
SKIP: { |
26 |
skip "no $param{marcdb} test file ", 17 unless (-e $param{marcdb}); |
skip "no $param{marcdb} test file ", 37 unless (-e $param{marcdb}); |
27 |
|
|
28 |
ok($marc = MARC::Fast->new(%param), "new"); |
ok($marc = MARC::Fast->new(%param), "new"); |
29 |
|
|
42 |
ok($marc->fetch($_), "fetch $_"); |
ok($marc->fetch($_), "fetch $_"); |
43 |
|
|
44 |
ok(my $hash = $marc->to_hash($_), "to_hash $_"); |
ok(my $hash = $marc->to_hash($_), "to_hash $_"); |
45 |
diag "$_ :: ",Dumper($hash); |
diag "to_hash($_) = ",dump($hash) if ($debug); |
46 |
|
ok(my $ascii = $marc->to_ascii($_), "to_ascii $_"); |
47 |
|
diag "to_ascii($_) ::\n$ascii" if ($debug); |
48 |
} |
} |
49 |
} |
} |