6 use Test::More tests => 9;
7 use Data::Dump qw/dump/;
10 use_ok( 'MARC::Fast' );
14 my $debug = shift @ARGV;
16 my $marc_file = 't/utf8.marc';
18 ok(my $marc = MARC::Fast->new(
22 $l = Encode::decode( 'utf-8', $l );
23 $l =~ s/knjiga/briga/;
28 cmp_ok($marc->count, '==', 1, 'count' );
30 ok(my $rec = $marc->fetch(1), "fetch 1");
31 diag dump $rec if $debug;
33 ok(my $hash = $marc->to_hash(1), "to_hash 1");
34 diag dump $hash if $debug;
36 cmp_ok( $hash->{260}->[0]->{'b'}, 'eq', "\x{160}kolska briga,", 'hash_filter from new' );
38 ok($hash = $marc->to_hash(1, hash_filter => sub {
40 $l = Encode::decode( 'utf-8', $l );
41 $l =~ s/knjiga/zabava/;
43 }), "to_hash 1 with hash_filter");
44 diag dump $hash if $debug;
46 cmp_ok( $hash->{260}->[0]->{'b'}, 'eq', "\x{160}kolska zabava,", 'hash_filter from to_hash' );