added test file
[webpac2] / t / 6-unit.t
index 6e226b3..bc4b944 100755 (executable)
@@ -7,9 +7,9 @@ use Test::Exception;
 use Cwd qw/abs_path/;
 use File::Temp qw/tempdir/;
 use File::Slurp;
-use Data::Dumper;
+use Data::Dump qw/dump/;
 use Time::HiRes qw/time/;
-use blib;
+use lib 'lib';
 
 my $debug = shift @ARGV;
 
@@ -39,14 +39,13 @@ my $lookup_file = "$abs_path../conf/lookup/isis.pm";
 
 ok(my $isis = new WebPAC::Input(
        module => 'WebPAC::Input::ISIS',
-       code_page => 'ISO-8859-2',      # application encoding
        limit => 100,
        no_progress_bar => 1,
 ), "new Input::ISIS");
 
 ok(my $maxmfn = $isis->open(
        path => $isis_file,
-       code_page => 'cp852',           # database encoding
+       input_encoding => 'cp852',              # database encoding
        lookup_coderef => sub {
                my $rec = shift || return;
                ok($rec, 'lookup_coderef has rec');
@@ -56,10 +55,9 @@ ok(my $maxmfn = $isis->open(
 
 ok(my $path = tempdir( CLEANUP => 1 ), "path");
 
-ok(my $db = new WebPAC::Store(
-       path => $path,
+ok(my $db = new WebPAC::Store({
        database => '.',
-), "new Store");
+}), "new Store");
 
 ok(my $norm_pl = read_file( $normalize_set_pl ), "set definitions: $normalize_set_pl" );
 
@@ -74,7 +72,7 @@ foreach my $pos ( 0 ... $isis->size ) {
 
        my $row = $isis->fetch || next;
 
-       diag " row $pos => ",Dumper($row) if ($debug);
+       diag " row $pos => ",dump($row) if ($debug);
 
        my $t = time();
        ok( my $ds = WebPAC::Normalize::data_structure(
@@ -83,7 +81,7 @@ foreach my $pos ( 0 ... $isis->size ) {
        ), "Set data_structure");
        $t_norm += time() - $t;
 
-       diag " ds $pos => ",Dumper($ds) if ($debug);
+       diag " ds $pos => ",dump($ds) if ($debug);
 
        ok(my $html = $out->apply(
                template => 'html.tt',