added test file
[webpac2] / t / 2-input-excel.t
index 962f48c..09f2314 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
 
 use strict;
-use blib;
+use lib 'lib';
 
-use Test::More tests => 49;
+use Test::More tests => 75;
 
 BEGIN {
 use_ok( 'WebPAC::Test' );
@@ -22,15 +22,14 @@ ok(my $input = new WebPAC::Input(
 our ($db,$size);
 
 sub open_xls {
-       my $args = shift;
-
-       $args->{path} = "$abs_path/data/" . $args->{path} || die "no path?";
-       ok(my $db = $input->open( %$args ), "open " . dump( $args ));
+       my $path = shift || die "no path?";
+       $path = "$abs_path/data/$path";
+       ok(my $db = $input->open( path => $path ), "open $path");
        ok($size = $input->size, "size $size");
        return $db;
 }
 
-open_xls({ path => 'excel_95.xls' });
+open_xls('excel_95.xls');
 
 foreach my $mfn ( 1 ... $size ) {
        my $rec = $input->fetch;
@@ -45,7 +44,10 @@ foreach my $mfn ( 1 ... $size ) {
        diag "rec: ", dump($rec), "\n" if $debug;
 }
 
-open_xls({ path => 'stara-signatura.xls', input_encoding => 'utf-16' });
-ok( $input->seek( 790 ), 'seek 790');
-ok( my $rec = $input->fetch, 'fetch' );
-diag dump( $rec );
+open_xls('stara-signatura.xls');
+for ( 1 .. 14 ) {
+       ok( $input->seek( $_ ), "seek $_");
+       ok( my $rec = $input->fetch, "fetch $_" );
+       diag dump( $rec ) if $debug;
+}
+