X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F2-input-excel.t;h=09f2314f21c9eca0c61ece691ed5676b6622f941;hb=87df497b2d849ea5fae2ba1641850af3dc1ba53e;hp=465fed3e6ca972635b9ee9ef02b1d80cb5272ed3;hpb=68af518c90e155829a4a76a8515cec4a9b6c86b3;p=webpac2 diff --git a/t/2-input-excel.t b/t/2-input-excel.t index 465fed3..09f2314 100755 --- a/t/2-input-excel.t +++ b/t/2-input-excel.t @@ -1,36 +1,35 @@ #!/usr/bin/perl -w -use Test::More tests => 45; -use Test::Exception; -use Cwd qw/abs_path/; -use blib; use strict; +use lib 'lib'; -use Data::Dumper; - -my $debug = 1; +use Test::More tests => 75; BEGIN { +use_ok( 'WebPAC::Test' ); use_ok( 'WebPAC::Input' ); } -ok(my $abs_path = abs_path($0), "abs_path"); -$abs_path =~ s#/[^/]*$#/#; - my $module = 'WebPAC::Input::Excel'; diag "testing with $module"; ok(my $input = new WebPAC::Input( module => $module, - no_log => 0, no_progress_bar => 1, - debug => $debug, + %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 $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 ) { my $rec = $input->fetch; @@ -42,6 +41,13 @@ foreach my $mfn ( 1 ... $size ) { cmp_ok($input->pos, '==', $mfn, "pos $mfn"); - diag "rec: ", Dumper($rec), "\n"; + diag "rec: ", dump($rec), "\n" if $debug; +} + +open_xls('stara-signatura.xls'); +for ( 1 .. 14 ) { + ok( $input->seek( $_ ), "seek $_"); + ok( my $rec = $input->fetch, "fetch $_" ); + diag dump( $rec ) if $debug; }