/[webpac2]/trunk/t/2-input-csv.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

Diff of /trunk/t/2-input-csv.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1253 by dpavlin, Tue May 19 14:46:12 2009 UTC revision 1254 by dpavlin, Mon Jul 27 16:24:41 2009 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
4  use blib;  use lib 'lib';
5    
6  use Test::More tests => 27;  use Test::More tests => 63;
7    
8  BEGIN {  BEGIN {
9  use_ok( 'WebPAC::Test' );  use_ok( 'WebPAC::Test' );
10  use_ok( 'WebPAC::Input' );  use_ok( 'WebPAC::Input' );
11    use_ok( 'Encode' );
12    use_ok( 'Devel::Peek' );
13  }  }
14    
15  my $module = 'WebPAC::Input::CSV';  my $module = 'WebPAC::Input::CSV';
# Line 23  ok(my $db = $input->open( Line 25  ok(my $db = $input->open(
25          path => "$abs_path/data/records-utf8.csv"          path => "$abs_path/data/records-utf8.csv"
26  ), "open");  ), "open");
27  ok(my $size = $input->size, "size");  ok(my $size = $input->size, "size");
28  cmp_ok( $size, '==', 7, 'size ok' );  cmp_ok( $size, '==', 11, 'size ok' );
29    
30  foreach my $mfn ( 1 ... $size ) {  foreach my $mfn ( 1 ... $size ) {
31          my $rec = $input->fetch;          my $rec = $input->fetch;
32          ok($rec, "fetch $mfn");          ok($rec, "fetch $mfn");
33          cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');          cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');
34          cmp_ok($input->pos, '==', $mfn, "pos $mfn");          cmp_ok($input->pos, '==', $mfn, "pos $mfn");
35    
36            ok( my $txt = $rec->{'E'}, 'E' );
37            diag Dump( $txt ) if $debug;
38            ok( Encode::is_utf8( $txt, 1 ), 'utf8' );
39          diag "rec: ", dump($rec), "\n" if $debug;          diag "rec: ", dump($rec), "\n" if $debug;
40  }  }
41    

Legend:
Removed from v.1253  
changed lines
  Added in v.1254

  ViewVC Help
Powered by ViewVC 1.1.26