--- trunk/t/2-input.t 2007/02/04 13:31:38 798 +++ trunk/t/2-input.t 2007/02/04 15:09:01 799 @@ -150,7 +150,7 @@ '^f' => { ' : ' => ' / ' }, } }, -), "open modify_isis (with modify_records)"); +), "open (with modify_records)"); # seek throws_ok { $input->seek } qr/without/, 'seek without position'; @@ -165,3 +165,27 @@ 'modify 200' ); +# modify_file + +my $modify_file = "$abs_path/conf/modify/test.pl"; + +ok($input->open( + path => "$abs_path/modify_isis/LIBRI", + modify_file => $modify_file, +), "open (with modify_file $modify_file)"); + +my $f = $WebPAC::Input::Test::filter_coderef; +ok(ref($f) eq 'CODE', 'filter_coderef'); + +diag "regexps = ", dump($input->modify_file_regexps( $modify_file )); + +sub test_filter { + my ($field, $from, $to) = @_; + cmp_ok( $f->( $from, $field, 1 ), 'eq', $to, "filter $field |$from| -> |$to|" ); +} + +test_filter(200, + '^a foo ; bar = baz : zzz', + '^a foo^kbar^dbaz^ezzz', +); +