r1729@llin: dpavlin | 2008-08-04 21:41:19 +0200
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 4 Aug 2008 19:41:26 +0000 (19:41 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 4 Aug 2008 19:41:26 +0000 (19:41 +0000)
 rewrite test to dump file which require formatted output,
 reduce size of test binary xls

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1106 07558da8-63fa-0310-ba24-9fe276d99e06

t/2-input-excel.t
t/data/stara-signatura.xls

index 962f48c..eaced70 100755 (executable)
@@ -3,7 +3,7 @@
 use strict;
 use blib;
 
-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;
+}
+
index d607861..1f76799 100644 (file)
Binary files a/t/data/stara-signatura.xls and b/t/data/stara-signatura.xls differ