--- trunk/t/2-input-excel.t 2008/08/02 15:15:04 1099 +++ trunk/t/2-input-excel.t 2008/08/02 23:46:41 1100 @@ -3,7 +3,7 @@ use strict; use blib; -use Test::More tests => 45; +use Test::More tests => 49; BEGIN { use_ok( 'WebPAC::Test' ); @@ -13,25 +13,24 @@ 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"); + +our ($db,$size); sub open_xls { + my $args = shift; - ok($input = new WebPAC::Input( - module => $module, - no_progress_bar => 1, - %LOG, - ), "new $module"); - - my $path = shift; - $path = "$abs_path/data/$path"; - ok(my $db = $input->open( path => $path ), "open $path"); + $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('excel_95.xls'); +open_xls({ path => 'excel_95.xls' }); foreach my $mfn ( 1 ... $size ) { my $rec = $input->fetch; @@ -46,8 +45,7 @@ diag "rec: ", dump($rec), "\n" if $debug; } -open_xls('stara-signatura.xls'); - -foreach my $mfn ( 20 .. 23 ) { - diag dump( $input->fetch( $mfn ) ) 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 );