blob: 30c41f0f9183ac7cd5032fff8e4651772c302d60 [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
6use lib 't/index';
7use TestInit;
8use Scalar::Util qw/weaken/;
9use Data::Dumper;
10
11use_ok('KorAP::Document');
12
13ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
14
15ok($tokens->add('DeReKo', 'Structure'), 'Add Structure');
16
17my $data = $tokens->to_data->{data};
18
19like($data->{foundries}, qr!dereko/structure!, 'data');
20like($data->{layerInfos}, qr!dereko/s=spans!, 'data');
21
22# Empty element (from 0 to 0) on level 1, with TUI 2
23is($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:
28is($data->{stream}->[0]->[10],
29 '@:dereko/s:version:1.1$<b>17<s>2',
30 'Attribute of idsHeader');
31
32is($data->{stream}->[0]->[11],
33 '@:dereko/s:TEIform:teiHeader$<b>17<s>2',
34 'Attribute of idsHeader');
35
36is($data->{stream}->[0]->[12],
37 '@:dereko/s:status:new$<b>17<s>2',
38 'Attribute of idsHeader');
39
40is($data->{stream}->[0]->[13],
41 '@:dereko/s:type:text$<b>17<s>2',
42 'Attribute of idsHeader');
43
44is($data->{stream}->[0]->[14],
45 '@:dereko/s:pattern:text$<b>17<s>2',
46 'Attribute of idsHeader');
47
48
49diag 'TODO: Test for element spans';
50
51done_testing;
52
53__END__