--- trunk/t/3-normalize-xml.t 2005/12/16 14:40:55 260 +++ trunk/t/3-normalize-xml.t 2005/12/23 21:05:50 314 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 74; +use Test::More tests => 76; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -142,3 +142,38 @@ #diag Dumper($rec, $ds); +# fake load of our test normalisation data +$n->{tag} = 'isis'; + +#diag Dumper($n->{import_xml}->{indexer}); + + +$rec = { + '900' => [ + { + 'a' => '1', + 'b' => '2', + 'c' => '3', + } + ], +}; + +my $import = { + 'Tag' => { 'isis' => [ + { content => 'v900^a + v900^b = v900^c' }, + ] }, +}; + +sub parse_test($$$) { + my ($import,$rec,$r) = @_; + $n->{import_xml}->{indexer} = $import; + # erase internal cache (yak!) + delete($n->{tags_by_order}); + push @{$rec->{'000'}}, 42; + diag "test normalisation of: ",Dumper($n->{import_xml}->{indexer}, $rec); + ok(my $ds = $n->data_structure( $rec ), "data_structure"); + diag Dumper($ds); + cmp_ok($ds->{Tag}->{display}->[0], 'eq', $r, "parse $r"); +} + +parse_test($import, $rec, '1 + 2 = 3');