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 | |
| 25 | # Attributes: |
| 26 | is($data->{stream}->[0]->[10], |
| 27 | '@:dereko/s:version:1.1$<b>17<s>2', |
| 28 | 'Attribute of idsHeader'); |
| 29 | |
| 30 | is($data->{stream}->[0]->[11], |
| 31 | '@:dereko/s:TEIform:teiHeader$<b>17<s>2', |
| 32 | 'Attribute of idsHeader'); |
| 33 | |
| 34 | is($data->{stream}->[0]->[12], |
| 35 | '@:dereko/s:status:new$<b>17<s>2', |
| 36 | 'Attribute of idsHeader'); |
| 37 | |
| 38 | is($data->{stream}->[0]->[13], |
| 39 | '@:dereko/s:type:text$<b>17<s>2', |
| 40 | 'Attribute of idsHeader'); |
| 41 | |
| 42 | is($data->{stream}->[0]->[14], |
| 43 | '@:dereko/s:pattern:text$<b>17<s>2', |
| 44 | 'Attribute of idsHeader'); |
| 45 | |
Akron | c078b9a | 2016-01-17 12:55:50 +0100 | [diff] [blame] | 46 | is($data->{stream}->[4]->[1], |
| 47 | '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1', |
| 48 | 'Sentence span'); |
| 49 | |
| 50 | is($data->{stream}->[4]->[2], |
| 51 | '@:dereko/s:broken:no$<b>17<s>1<i>6', |
| 52 | 'Attribute of sentence span'); |
| 53 | |
| 54 | is($data->{stream}->[6]->[0], |
| 55 | '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1', |
| 56 | 'Pagebreak element'); |
Akron | 601fc15 | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 57 | |
| 58 | done_testing; |
| 59 | |
| 60 | __END__ |