--- trunk/t/2-input.t 2006/05/15 13:15:01 507 +++ trunk/t/2-input.t 2006/07/13 13:55:19 599 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 62; +use Test::More tests => 68; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -30,8 +30,8 @@ throws_ok { $input->open( path => '/dev/null', ) } qr/can't find database/ , "open"; -ok($input->open( path => "$abs_path/winisis/BIBL" ), "open"); -ok($input_lm->open( path => "$abs_path/winisis/BIBL", low_mem => 1 ), "open"); +ok($input->open( path => "$abs_path/winisis/BIBL" ), "open winisis"); +ok($input_lm->open( path => "$abs_path/winisis/BIBL", low_mem => 1 ), "open winisis"); sub test_after_open($) { my $input = shift; @@ -68,7 +68,7 @@ diag "offset $s, limit: $l, expected: $e"; - ok($s = $input->open( path => "$abs_path/winisis/BIBL", offset => $s, limit => $l, debug => 1 ), "open"); + ok($s = $input->open( path => "$abs_path/winisis/BIBL", offset => $s, limit => $l, debug => 1 ), "open winisis"); cmp_ok($s, '==', $size, "db size from open = $size"); cmp_ok($input->size, '==', $e, "input->size = $e"); } @@ -86,9 +86,28 @@ ok($input = new WebPAC::Input( module => $module, low_mem => 1, no_log => $no_log, no_progress_bar => 1 ), "new $module"); -ok($input->open( path => "$abs_path/data/marc.iso" ), "open"); +ok($input->open( path => "$abs_path/data/marc.iso" ), "open marc.iso"); test_after_open($input); test_fetch($input, $input->size); +# test modify_record +$module = 'WebPAC::Input::ISIS'; +ok($input = new WebPAC::Input( module => $module, no_log => $no_log, no_progress_bar => 1 ), "new $module"); + +ok($input->open( path => "$abs_path/modify_isis/LIBRI",), "open modify_isis (plain)"); +ok(my $rec_p = $input->fetch, 'fetch'); + +ok($input->open( + path => "$abs_path/modify_isis/LIBRI", + modify_records => { + 200 => { + '*' => { '^c' => '. ' }, + } + }, +), "open modify_isis (with modify_records)"); + +ok(my $rec = $input->fetch, 'fetch'); + +cmp_ok($rec_p->{200}->[0]->{f} . '. ' . $rec_p->{200}->[0]->{c}, 'eq' ,$rec->{200}->[0]->{f}, 'modify_records working');