added test file
[webpac2] / t / 2-input-excel.t
index b46ebf2..09f2314 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
 
 use strict;
-use blib;
+use lib 'lib';
 
-use Test::More tests => 45;
+use Test::More tests => 75;
 
 BEGIN {
 use_ok( 'WebPAC::Test' );
@@ -13,24 +13,22 @@ use_ok( 'WebPAC::Input' );
 my $module = 'WebPAC::Input::Excel';
 diag "testing with $module";
 
-our ($input,$db,$size);
+ok(my $input = new WebPAC::Input(
+       module => $module,
+       no_progress_bar => 1,
+       %LOG,
+), "new");
 
-sub open_xls {
-
-       ok($input = new WebPAC::Input(
-               module => $module,
-               no_progress_bar => 1,
-               %LOG,
-       ), "new $module");
+our ($db,$size);
 
-       my $path = shift;
+sub open_xls {
+       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('excel_95.xls');
 
 foreach my $mfn ( 1 ... $size ) {
@@ -47,7 +45,9 @@ foreach my $mfn ( 1 ... $size ) {
 }
 
 open_xls('stara-signatura.xls');
-
-foreach my $mfn ( 20 .. 23 ) {
-       diag dump( $input->fetch( $mfn ) ) if $debug;
+for ( 1 .. 14 ) {
+       ok( $input->seek( $_ ), "seek $_");
+       ok( my $rec = $input->fetch, "fetch $_" );
+       diag dump( $rec ) if $debug;
 }
+