Akron | a866578 | 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'; |
| 9 | use TestInit; |
| 10 | use File::Basename 'dirname'; |
| 11 | use File::Spec::Functions 'catdir'; |
| 12 | |
| 13 | |
| 14 | my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001'); |
| 15 | |
| 16 | ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document'); |
| 17 | ok($doc->parse, 'Parse document'); |
| 18 | like($doc->path, qr!$path/!, 'Path'); |
| 19 | |
| 20 | # Metdata |
| 21 | is($doc->text_sigle, 'Corpus_Doc.0001', 'ID-text'); |
| 22 | is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc'); |
| 23 | is($doc->corpus_sigle, 'Corpus', 'ID-corpus'); |
| 24 | |
| 25 | is($doc->title, 'Beispiel Text', 'title'); |
| 26 | is($doc->sub_title, 'Beispiel Text Untertitel', 'title'); |
| 27 | is($doc->pub_date, '20010402', 'Publication date'); |
| 28 | is($doc->pub_place, 'Mannheim', 'Publication place'); |
| 29 | is($doc->author, 'Mustermann, Max', 'Author'); |
| 30 | |
| 31 | is($doc->publisher, 'Artificial articles Inc.', 'Publisher'); |
| 32 | is($doc->editor, 'Monika Mustermann', 'Editor'); |
| 33 | is($doc->text_type, 'Zeitung: Tageszeitung', 'Text Type'); |
| 34 | is($doc->text_type_art, 'Bericht', 'Text Type Art'); |
| 35 | is($doc->text_type_ref, 'Aphorismen', 'Text Type Ref'); |
| 36 | ok(!$doc->text_column, 'Text Column'); |
| 37 | ok(!$doc->text_domain, 'Text Domain'); |
| 38 | is($doc->creation_date, '19990601', 'Creation Date'); |
| 39 | ok(!$doc->license, 'License'); |
| 40 | ok(!$doc->pages, 'Pages'); |
| 41 | ok(!$doc->file_edition_statement, 'File Edition Statement'); |
| 42 | ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement'); |
| 43 | ok(!$doc->reference, 'Reference'); |
| 44 | is($doc->language, 'de', 'Language'); |
| 45 | |
| 46 | is($doc->doc_title, 'Beispiel Dokument', 'Doc: title'); |
| 47 | ok(!$doc->doc_sub_title, 'Doc: subtitle'); |
| 48 | ok(!$doc->doc_editor, 'Doc: editor'); |
| 49 | ok(!$doc->doc_author, 'Doc: author'); |
| 50 | |
| 51 | is($doc->corpus_title, 'Beispiel-Corpus', 'Corpus: title'); |
| 52 | ok(!$doc->corpus_sub_title, 'Corpus: subtitle'); |
| 53 | ok(!$doc->corpus_editor, 'Corpus: editor'); |
| 54 | ok(!$doc->corpus_author, 'Corpus: author'); |
| 55 | |
| 56 | done_testing; |
| 57 | |
| 58 | __END__ |