1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use Test::More tests => 61; |
use Test::More tests => 62; |
4 |
use Test::Exception; |
use Test::Exception; |
5 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
6 |
use blib; |
use blib; |
7 |
use strict; |
use strict; |
8 |
|
|
9 |
|
use Data::Dumper; |
10 |
|
|
11 |
BEGIN { |
BEGIN { |
12 |
use_ok( 'WebPAC::Input::ISIS' ); |
use_ok( 'WebPAC::Input::ISIS' ); |
13 |
use_ok( 'WebPAC::Input::MARC' ); |
use_ok( 'WebPAC::Input::MARC' ); |
14 |
} |
} |
15 |
|
|
16 |
|
my $debug = 1; |
17 |
|
my $no_log = $debug ? 0 : 1; |
18 |
|
|
19 |
ok(my $abs_path = abs_path($0), "abs_path"); |
ok(my $abs_path = abs_path($0), "abs_path"); |
20 |
$abs_path =~ s#/[^/]*$#/#; |
$abs_path =~ s#/[^/]*$#/#; |
21 |
|
|
23 |
diag "testing with $module"; |
diag "testing with $module"; |
24 |
|
|
25 |
throws_ok { my $input = new WebPAC::Input( ) } qr/module/, "need module"; |
throws_ok { my $input = new WebPAC::Input( ) } qr/module/, "need module"; |
26 |
ok(my $input = new WebPAC::Input( module => $module, no_log => 0, no_progress_bar => 1 ), "new"); |
ok(my $input = new WebPAC::Input( module => $module, no_log => $no_log, no_progress_bar => 1, stats => 1 ), "new"); |
27 |
ok(my $input_lm = new WebPAC::Input( module => $module, low_mem => 1, no_log => 1, no_progress_bar => 1 ), "new $module"); |
ok(my $input_lm = new WebPAC::Input( module => $module, low_mem => 1, no_log => $no_log, no_progress_bar => 1 ), "new $module"); |
28 |
|
|
29 |
throws_ok { $input->open( ) } qr/path/, "need path"; |
throws_ok { $input->open( ) } qr/path/, "need path"; |
30 |
|
|
78 |
test_start_limit($input, 3, $size, $size - 2); |
test_start_limit($input, 3, $size, $size - 2); |
79 |
test_start_limit($input, 1, $size + 2, $size); |
test_start_limit($input, 1, $size + 2, $size); |
80 |
|
|
81 |
|
ok(my $s = $input->stats, 'stats'); |
82 |
|
diag "stats: ",Dumper($s); |
83 |
|
|
84 |
$module = 'WebPAC::Input::MARC'; |
$module = 'WebPAC::Input::MARC'; |
85 |
diag "testing with $module"; |
diag "testing with $module"; |
86 |
|
|
87 |
ok($input = new WebPAC::Input( module => $module, low_mem => 1, no_log => 1, no_progress_bar => 1 ), "new $module"); |
ok($input = new WebPAC::Input( module => $module, low_mem => 1, no_log => $no_log, no_progress_bar => 1 ), "new $module"); |
88 |
|
|
89 |
ok($input->open( path => "$abs_path/data/marc.iso" ), "open"); |
ok($input->open( path => "$abs_path/data/marc.iso" ), "open"); |
90 |
|
|