Akron | ef8544f | 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 | |
| 11 | use_ok('KorAP::Document'); |
| 12 | |
| 13 | ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens'); |
| 14 | |
| 15 | ok($tokens->add('DeReKo', 'Structure'), 'Add Structure'); |
| 16 | |
| 17 | my $data = $tokens->to_data->{data}; |
| 18 | |
| 19 | like($data->{foundries}, qr!dereko/structure!, 'data'); |
| 20 | like($data->{layerInfos}, qr!dereko/s=spans!, 'data'); |
| 21 | |
| 22 | # Empty element (from 0 to 0) on level 1, with TUI 2 |
| 23 | is($data->{stream}->[0]->[1], |
| 24 | '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>1<b>1<s>2', |
| 25 | 'Empty element'); |
| 26 | |
| 27 | # Attributes: |
| 28 | is($data->{stream}->[0]->[10], |
| 29 | '@:dereko/s:version:1.1$<b>17<s>2', |
| 30 | 'Attribute of idsHeader'); |
| 31 | |
| 32 | is($data->{stream}->[0]->[11], |
| 33 | '@:dereko/s:TEIform:teiHeader$<b>17<s>2', |
| 34 | 'Attribute of idsHeader'); |
| 35 | |
| 36 | is($data->{stream}->[0]->[12], |
| 37 | '@:dereko/s:status:new$<b>17<s>2', |
| 38 | 'Attribute of idsHeader'); |
| 39 | |
| 40 | is($data->{stream}->[0]->[13], |
| 41 | '@:dereko/s:type:text$<b>17<s>2', |
| 42 | 'Attribute of idsHeader'); |
| 43 | |
| 44 | is($data->{stream}->[0]->[14], |
| 45 | '@:dereko/s:pattern:text$<b>17<s>2', |
| 46 | 'Attribute of idsHeader'); |
| 47 | |
| 48 | |
| 49 | diag 'TODO: Test for element spans'; |
| 50 | |
| 51 | done_testing; |
| 52 | |
| 53 | __END__ |