13 |
|
|
14 |
ok(my $abs_path = abs_path($0), "abs_path"); |
ok(my $abs_path = abs_path($0), "abs_path"); |
15 |
$abs_path =~ s#/[^/]*$#/#; |
$abs_path =~ s#/[^/]*$#/#; |
16 |
diag "abs_path: $abs_path"; |
#diag "abs_path: $abs_path"; |
17 |
|
|
18 |
throws_ok { new WebPAC::Normalize::XML( lookup_regex => 'foo' ) } qr/pair/, "lookup_regex without lookup"; |
throws_ok { new WebPAC::Normalize::XML( lookup_regex => 'foo' ) } qr/pair/, "lookup_regex without lookup"; |
19 |
throws_ok { new WebPAC::Normalize::XML( lookup => 'bar' ) } qr/pair/, "lookup without lookup_regex"; |
throws_ok { new WebPAC::Normalize::XML( lookup => 'bar' ) } qr/pair/, "lookup without lookup_regex"; |
20 |
|
|
21 |
ok(my $n = new WebPAC::Normalize::XML( |
ok(my $n = new WebPAC::Normalize::XML( |
22 |
debug => 1, |
debug => 0, |
23 |
filter => { |
filter => { |
24 |
regex => sub { |
regex => sub { |
25 |
my ($val, $regex) = @_; |
my ($val, $regex) = @_; |
169 |
# erase internal cache (yak!) |
# erase internal cache (yak!) |
170 |
delete($n->{tags_by_order}); |
delete($n->{tags_by_order}); |
171 |
push @{$rec->{'000'}}, 42 unless ($rec->{'000'}); |
push @{$rec->{'000'}}, 42 unless ($rec->{'000'}); |
172 |
diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec); |
#diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec); |
173 |
ok(my $ds = $n->data_structure( $rec ), "data_structure"); |
ok(my $ds = $n->data_structure( $rec ), "data_structure"); |
174 |
diag Dumper($ds); |
#diag Dumper($ds); |
175 |
cmp_ok($ds->{Tag}->{display}->[0], 'eq', $r, "parse $r"); |
cmp_ok($ds->{Tag}->{display}->[0], 'eq', $r, "parse $r"); |
176 |
} |
} |
177 |
|
|