#!perl use strict; use warnings; use Test::More; use Test::Exception; my $pkg; BEGIN { $pkg = 'Catmandu::Fix::Condition::marc_any_match'; use_ok $pkg; } require_ok $pkg; my $mrc = <<'MRC'; 92005291 Title / Name X Y Z MRC note 'marc_any_match(999,A)'; { my $importer = Catmandu->importer( 'MARC', file => \$mrc, type => 'XML', fix => 'if marc_any_match(999,A) add_field(test,failed) end' ); my $record = $importer->first; ok ! $record->{test} , 'ok matched nothing'; } note 'marc_any_match(999,X)'; { my $importer = Catmandu->importer( 'MARC', file => \$mrc, type => 'XML', fix => 'if marc_any_match(999,X) add_field(test,ok) end' ); my $record = $importer->first; is $record->{test} , 'ok' , 'ok matched something' } note 'marc_any_match(999,[XYZ])'; { my $importer = Catmandu->importer( 'MARC', file => \$mrc, type => 'XML', fix => 'if marc_any_match(999,[XYZ]) add_field(test,ok) end' ); my $record = $importer->first; is $record->{test} , 'ok' , 'ok matched something' } done_testing;