dump tsv file for TokyoCabinet import
[MARC-Fast] / t / 003_marc-repeatable.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use lib 'lib';
5
6 use Test::More tests => 8;
7 use Data::Dump qw/dump/;
8
9 BEGIN {
10         use_ok( 'MARC::Fast' );
11         use_ok( 'Encode' );
12 }
13
14 my $debug = shift @ARGV;
15
16 my $marc_file = 't/koha-232766.mrc';
17
18 ok(my $marc = MARC::Fast->new(
19         marcdb => $marc_file,
20 ), "new");
21
22 cmp_ok($marc->count, '==', 1, 'count' );
23
24 ok(my $rec = $marc->fetch(1), "fetch 1");
25 diag dump $rec if $debug;
26
27 ok(my $hash = $marc->to_hash(1, include_subfields => 1), "to_hash 1 include_subfields");
28 diag dump $hash if $debug;
29
30 ok( ref $hash->{653}->[0]->{'a'} eq '', 'first occurance not repeatable' );
31 ok( ref $hash->{653}->[1]->{'a'} eq 'ARRAY', 'second is repetable' );
32