--- trunk/t/3-normalize-xml.t 2005/12/23 21:17:37 315 +++ trunk/t/3-normalize-xml.t 2006/01/07 18:23:27 352 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 76; +use Test::More tests => 84; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -13,13 +13,13 @@ ok(my $abs_path = abs_path($0), "abs_path"); $abs_path =~ s#/[^/]*$#/#; -diag "abs_path: $abs_path"; +#diag "abs_path: $abs_path"; throws_ok { new WebPAC::Normalize::XML( lookup_regex => 'foo' ) } qr/pair/, "lookup_regex without lookup"; throws_ok { new WebPAC::Normalize::XML( lookup => 'bar' ) } qr/pair/, "lookup without lookup_regex"; ok(my $n = new WebPAC::Normalize::XML( - debug => 1, + debug => 0, filter => { regex => sub { my ($val, $regex) = @_; @@ -153,13 +153,13 @@ 'a' => '1', 'b' => '2', 'c' => '3', - 'txt' => 'yap', + 'x' => 'yap', } ], }; my $import = { 'Tag' => { 'isis' => [ - { content => 'v900^a + v900^b = v900^c [txt]' }, + { content => 'v900^a + v900^b = v900^c [v900^x]' }, ] }, }; @@ -169,9 +169,9 @@ # erase internal cache (yak!) delete($n->{tags_by_order}); push @{$rec->{'000'}}, 42 unless ($rec->{'000'}); - diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec); + #diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec); ok(my $ds = $n->data_structure( $rec ), "data_structure"); - diag Dumper($ds); + #diag Dumper($ds); cmp_ok($ds->{Tag}->{display}->[0], 'eq', $r, "parse $r"); } @@ -185,9 +185,10 @@ parse_test($import, $rec, '1 + 5 = 6 [yap]'); delete($rec->{'900'}->[0]->{'c'}); -parse_test($import, $rec, '1 + 5'); +$rec->{'900'}->[0]->{'x'} = 'hmmm'; +parse_test($import, $rec, '1 + 5 [hmmm]'); -$rec->{'900'}->[0]->{'txt'} = 'nope!'; +$rec->{'900'}->[0]->{'x'} = 'nope!'; delete($rec->{'900'}->[0]->{'a'}); parse_test($import, $rec, '5 [nope!]');