Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use utf8; |
| 5 | use Test::More; |
| 6 | use lib 't/index'; |
| 7 | use TestInit; |
| 8 | use Scalar::Util qw/weaken/; |
| 9 | use Data::Dumper; |
| 10 | |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 11 | ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens'); |
| 12 | |
| 13 | ok($tokens->add('DeReKo', 'Structure'), 'Add Structure'); |
| 14 | |
| 15 | my $data = $tokens->to_data->{data}; |
| 16 | |
| 17 | like($data->{foundries}, qr!dereko/structure!, 'data'); |
| 18 | like($data->{layerInfos}, qr!dereko/s=spans!, 'data'); |
| 19 | |
| 20 | # Empty element (from 0 to 0) on level 1, with TUI 2 |
| 21 | is($data->{stream}->[0]->[1], |
Akron | c078b9a | 2016-01-17 12:55:50 +0100 | [diff] [blame] | 22 | '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2', |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 23 | 'Empty element'); |
| 24 | |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 25 | |
Akron | f6b2041 | 2016-02-25 23:56:49 +0100 | [diff] [blame^] | 26 | is($data->{stream}->[0]->[5], '<>:base/s:t$<b>64<i>0<i>129<i>17<b>0', 'Text boundary'); |
| 27 | |
| 28 | # Attributes: |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 29 | is($data->{stream}->[0]->[11], |
Akron | f6b2041 | 2016-02-25 23:56:49 +0100 | [diff] [blame^] | 30 | '@:dereko/s:type:text$<b>17<s>2', |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 31 | 'Attribute of idsHeader'); |
| 32 | |
| 33 | is($data->{stream}->[0]->[12], |
| 34 | '@:dereko/s:status:new$<b>17<s>2', |
| 35 | 'Attribute of idsHeader'); |
| 36 | |
| 37 | is($data->{stream}->[0]->[13], |
Akron | f6b2041 | 2016-02-25 23:56:49 +0100 | [diff] [blame^] | 38 | '@:dereko/s:version:1.1$<b>17<s>2', |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 39 | 'Attribute of idsHeader'); |
| 40 | |
Akron | f6b2041 | 2016-02-25 23:56:49 +0100 | [diff] [blame^] | 41 | |
| 42 | |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 43 | is($data->{stream}->[0]->[14], |
| 44 | '@:dereko/s:pattern:text$<b>17<s>2', |
| 45 | 'Attribute of idsHeader'); |
| 46 | |
Akron | c078b9a | 2016-01-17 12:55:50 +0100 | [diff] [blame] | 47 | is($data->{stream}->[4]->[1], |
| 48 | '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1', |
| 49 | 'Sentence span'); |
| 50 | |
| 51 | is($data->{stream}->[4]->[2], |
| 52 | '@:dereko/s:broken:no$<b>17<s>1<i>6', |
| 53 | 'Attribute of sentence span'); |
| 54 | |
| 55 | is($data->{stream}->[6]->[0], |
| 56 | '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1', |
| 57 | 'Pagebreak element'); |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 58 | |
| 59 | done_testing; |
| 60 | |
| 61 | __END__ |