blob: 952c4b7246a12e5479a691e358f597620b61aef1 [file] [log] [blame]
Akron09e0b2c2020-07-28 15:57:01 +02001use strict;
2use warnings;
3use Test::More;
4use Test::XML::Loy;
5
6use FindBin;
7BEGIN {
8 unshift @INC, "$FindBin::Bin/../lib";
9};
10
11use_ok('KorAP::XML::TEI::Tokenizer::Collector');
12
13my $t = KorAP::XML::TEI::Tokenizer::Collector->new;
14
15$t->add_token('x1',0,8);
16my $token = $t->add_token('x2',9,14,2);
17$t->add_token('x3',15,20);
18
19my $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
45done_testing;
46