--- trunk/t/3-normalize.t 2006/10/05 12:57:51 736 +++ trunk/t/3-normalize.t 2007/04/01 21:47:40 811 @@ -2,7 +2,7 @@ use strict; -use Test::More tests => 309; +use Test::More tests => 322; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -194,13 +194,20 @@ cmp_ok( join('', suffix('xy', 'cd') ), 'eq', 'cdxy', 'suffix'); cmp_ok( join('', surround('->', '<-', 'a','b','c') ), 'eq', '->a<-->b<-->c<-', 'surround'); + # count + my @el; + for my $i ( 0 .. 10 ) { + cmp_ok( count( @el ), '==', $i, "count($i)"); + push @el, "element $i"; + } + # lookups throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()'; ok(_set_load_row(sub { my ($database,$input,$mfn) = @_; - diag "load_row( $database, $input, $mfn )"; + diag "load_row( $database, $input, $mfn )" if ($debug); cmp_ok( $#_, '==', 2, 'have 3 arguments'); ok($database, '_load_row database'); ok($input, '_load_row input'); @@ -229,13 +236,13 @@ ); ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup'); - diag "_get_lookup = ", dump($l); + diag "_get_lookup = ", dump($l) if ($debug); my @lookup; ok(@lookup = lookup( sub { - diag "in show"; + diag "in show" if ($debug); rec('900','x'); }, 'db','input','key', @@ -254,7 +261,7 @@ } ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup'); - diag "_get_lookup = ", dump($l); + diag "_get_lookup = ", dump($l) if ($debug); is_deeply( $l, { db => { @@ -274,7 +281,7 @@ ####### - diag "lookup_hash1 = ", dump($lookup_hash1); + diag "lookup_hash1 = ", dump($lookup_hash1) if ($debug); ok(_set_lookup( $lookup_hash1 ), '_set_lookup $lookup_hash1'); throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()'; @@ -725,6 +732,10 @@ [ '901', ' ', ' ', 'b', 'bar', 'c', 'baz' ], ], ); + + test_s(qq{ marc_remove('*'); }); + ok(! WebPAC::Normalize::_get_marc_fields(), 'marc_remove(*)'); + test_rec_rules( 'marc_duplicate', { '200' => [{ a => 42, b => 'bar', c => 'baz', d => 'bing', e => 'bong' }] },