Make cleanup of encodings, moving webpac closer to having
[webpac2] / t / 2-input-excel.t
index da57366..962f48c 100755 (executable)
@@ -3,7 +3,7 @@
 use strict;
 use blib;
 
-use Test::More tests => 45;
+use Test::More tests => 49;
 
 BEGIN {
 use_ok( 'WebPAC::Test' );
@@ -19,10 +19,18 @@ ok(my $input = new WebPAC::Input(
        %LOG,
 ), "new");
 
-ok(my $db = $input->open(
-       path => "$abs_path/data/excel_95.xls"
-), "open");
-ok(my $size = $input->size, "size");
+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 ));
+       ok($size = $input->size, "size $size");
+       return $db;
+}
+
+open_xls({ path => 'excel_95.xls' });
 
 foreach my $mfn ( 1 ... $size ) {
        my $rec = $input->fetch;
@@ -37,3 +45,7 @@ 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 );