Akron | 09e0b2c | 2020-07-28 15:57:01 +0200 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use Test::XML::Loy; |
| 5 | |
| 6 | use FindBin; |
| 7 | BEGIN { |
| 8 | unshift @INC, "$FindBin::Bin/../lib"; |
| 9 | }; |
| 10 | |
| 11 | use_ok('KorAP::XML::TEI::Tokenizer::Collector'); |
| 12 | |
| 13 | my $t = KorAP::XML::TEI::Tokenizer::Collector->new; |
| 14 | |
| 15 | $t->add_token('x1',0,8); |
| 16 | my $token = $t->add_token('x2',9,14,2); |
| 17 | $t->add_token('x3',15,20); |
| 18 | |
| 19 | my $loy = Test::XML::Loy->new($token->to_string(2)); |
| 20 | |
| 21 | $loy->attr_is('span', 'id', 's2') |
| 22 | ->attr_is('span', 'from', 9) |
| 23 | ->attr_is('span', 'to', 14) |
| 24 | ->attr_is('span', 'l', 2) |
| 25 | ->attr_is('span fs f', 'name', 'lex') |
| 26 | ; |
| 27 | |
| 28 | $loy = Test::XML::Loy->new($t->last_token->to_string(3)); |
| 29 | |
| 30 | $loy->attr_is('span', 'id', 's3') |
| 31 | ->attr_is('span', 'from', 15) |
| 32 | ->attr_is('span', 'to', 20) |
| 33 | ->attr_is('span fs f', 'name', 'lex') |
| 34 | ; |
| 35 | |
| 36 | $loy = Test::XML::Loy->new($t->to_string('text', 0)) |
| 37 | ->attr_is('layer', 'docid', 'text') |
| 38 | ->attr_is('span#s0', 'to', '8') |
| 39 | ->attr_is('span#s1', 'to', '14') |
| 40 | ->attr_is('span#s1', 'l', '2') |
| 41 | ->attr_is('span#s2', 'to', '20') |
| 42 | ; |
| 43 | |
| 44 | |
| 45 | done_testing; |
| 46 | |