r1115@llin: dpavlin | 2006-10-31 14:45:15 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 31 Oct 2006 13:44:42 +0000 (13:44 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 31 Oct 2006 13:44:42 +0000 (13:44 +0000)
 fix unit test by removing old lookup code (but, it's missing new one now)

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@767 07558da8-63fa-0310-ba24-9fe276d99e06

t/6-unit.t

index 6a6c519..6e226b3 100755 (executable)
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 24;
+use Test::More tests => 31;
 use Test::Exception;
 use Cwd qw/abs_path/;
 use File::Temp qw/tempdir/;
@@ -13,11 +13,13 @@ use blib;
 
 my $debug = shift @ARGV;
 
+#
+# FIXME add lookup testing!
+#
+
 BEGIN {
-use_ok( 'WebPAC::Lookup' );
 use_ok( 'WebPAC::Input' );
 use_ok( 'WebPAC::Store' );
-use_ok( 'WebPAC::Lookup::Normalize' );
 use_ok( 'WebPAC::Normalize' );
 use_ok( 'WebPAC::Output::TT' );
 }
@@ -35,10 +37,6 @@ diag "isis_file: $isis_file" if ($debug);
 my $normalize_set_pl = "$abs_path/data/normalize.pl";
 my $lookup_file = "$abs_path../conf/lookup/isis.pm";
 
-ok(my $lookup = new WebPAC::Lookup(
-       lookup_file => $lookup_file,
-), "new Lookup");
-
 ok(my $isis = new WebPAC::Input(
        module => 'WebPAC::Input::ISIS',
        code_page => 'ISO-8859-2',      # application encoding
@@ -51,7 +49,8 @@ ok(my $maxmfn = $isis->open(
        code_page => 'cp852',           # database encoding
        lookup_coderef => sub {
                my $rec = shift || return;
-               $lookup->add( $rec );
+               ok($rec, 'lookup_coderef has rec');
+               ok(defined($rec->{'000'}->[0]), 'have mfn');
        },
 ), "Input::ISIS->open");
 
@@ -69,8 +68,6 @@ ok(my $out = new WebPAC::Output::TT(
        filters => { foo => sub { shift } },
 ), "new Output::TT");
 
-diag " lookup => ",Dumper($lookup->lookup_hash) if ($debug);
-
 my $t_norm = 0;
 
 foreach my $pos ( 0 ... $isis->size ) {
@@ -81,7 +78,6 @@ foreach my $pos ( 0 ... $isis->size ) {
 
        my $t = time();
        ok( my $ds = WebPAC::Normalize::data_structure(
-               lookup => $lookup->lookup_hash,
                row => $row,
                rules => $norm_pl,
        ), "Set data_structure");