/[MARC-Fast]/trunk/t/003_marc-repeatable.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/003_marc-repeatable.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (hide annotations)
Thu Sep 23 13:14:37 2010 UTC (13 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 663 byte(s)
better example with repetable field and subfields
1 dpavlin 40 #!/usr/bin/perl -w
2    
3     use strict;
4     use lib 'lib';
5    
6 dpavlin 43 use Test::More tests => 8;
7 dpavlin 40 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 dpavlin 43 my $marc_file = 't/koha-232766.mrc';
17 dpavlin 40
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 dpavlin 43 ok( ref $hash->{653}->[0]->{'a'} eq '', 'first occurance not repeatable' );
31     ok( ref $hash->{653}->[1]->{'a'} eq 'ARRAY', 'second is repetable' );
32 dpavlin 40

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26