Akron | 9d8cbc5 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use utf8; |
| 5 | use Test::More; |
| 6 | use Scalar::Util qw/weaken/; |
| 7 | use Data::Dumper; |
| 8 | use lib 't/index'; |
Akron | 8fa76bc | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 9 | use KorAP::XML::Krill; |
Akron | 9d8cbc5 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 10 | use File::Basename 'dirname'; |
| 11 | use File::Spec::Functions 'catdir'; |
| 12 | |
| 13 | |
| 14 | my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001'); |
| 15 | |
Akron | 8fa76bc | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 16 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::XML::Krill'); |
Akron | 9d8cbc5 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 17 | ok($doc->parse, 'Parse document'); |
| 18 | like($doc->path, qr!$path/!, 'Path'); |
| 19 | |
| 20 | is($doc->primary->data, |
| 21 | 'Zum letzten kulturellen Anlass lädt die Leitung des Schulheimes Hofbergli ein, '. |
| 22 | 'bevor der Betrieb Ende Schuljahr eingestellt wird.', 'Primary data'); |
| 23 | |
| 24 | is($doc->primary->data_length, 129, 'Primary data length'); |
| 25 | |
| 26 | is($doc->primary->data(0,3), 'Zum', 'Get primary data'); |
| 27 | |
| 28 | |
| 29 | done_testing; |
| 30 | |
| 31 | __END__ |