added test to manifest
[MARC-Fast] / t / 002_marc-utf8.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use blib;
5
6 use Test::More tests => 7;
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/utf8.marc';
17
18 ok(my $marc = MARC::Fast->new(
19         marcdb => $marc_file,
20         hash_filter => sub {
21                 Encode::decode( 'utf-8', $_[0] );
22         },
23 ), "new");
24
25 cmp_ok($marc->count, '==', 1, 'count' );
26
27 ok(my $rec = $marc->fetch(1), "fetch 1");
28 diag dump $rec if $debug;
29
30 ok(my $hash = $marc->to_hash(1), "to_hash 1");
31 diag dump $hash if $debug;
32
33 ok( $hash->{260}->[0]->{'b'} eq "\x{160}kolska knjiga,", 'utf-8 flag' );
34