Akron | b2636cf | 2016-01-26 18:42:44 +0100 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use File::Basename 'dirname'; |
| 5 | use File::Spec::Functions 'catdir'; |
| 6 | use Data::Dumper; |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 7 | use KorAP::XML::Tokenizer; |
| 8 | use KorAP::XML::Krill; |
Akron | b2636cf | 2016-01-26 18:42:44 +0100 | [diff] [blame] | 9 | use utf8; |
| 10 | |
| 11 | my $path = catdir(dirname(__FILE__), 'TEST', 'BSP', 1); |
| 12 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 13 | ok(my $doc = KorAP::XML::Krill->new( |
Akron | b2636cf | 2016-01-26 18:42:44 +0100 | [diff] [blame] | 14 | path => $path . '/' |
| 15 | ), 'Create Document'); |
| 16 | |
| 17 | ok($doc->parse, 'Parse document'); |
| 18 | |
| 19 | like($doc->path, qr!$path/!, 'Path'); |
| 20 | |
| 21 | # Metdata |
| 22 | is($doc->text_sigle, 'TEST_BSP.1', 'ID-text'); |
| 23 | is($doc->doc_sigle, 'TEST_BSP', 'ID-doc'); |
| 24 | is($doc->corpus_sigle, 'TEST', 'ID-corpus'); |
| 25 | |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 26 | is($doc->title, 'Sommerüberraschung', 'title'); |
| 27 | #is($doc->sub_title, 'Beispiel Text Untertitel', 'title'); |
| 28 | #is($doc->pub_date, '20010402', 'Publication date'); |
| 29 | #is($doc->pub_place, 'Mannheim', 'Publication place'); |
| 30 | is($doc->author, 'TEST.BSP.Autoren.1', 'Author'); |
| 31 | is($doc->store('sgbrAuthorAgeClass'), 'X', 'AgeClass'); |
| 32 | is($doc->store('sgbrAuthorSex'), 'M', 'Sex'); |
| 33 | is($doc->store('sgbrKodex'), 'M', 'Kodex'); |
| 34 | |
| 35 | is($doc->doc_title, 'Beispielkorpus', 'Doc: title'); |
| 36 | is($doc->doc_sub_title, 'Subkorpus Beispieltext', 'Doc: subtitle'); |
| 37 | |
| 38 | is($doc->language, 'de', 'Language'); |
| 39 | |
| 40 | ok(!$doc->publisher, 'Publisher'); |
| 41 | ok(!$doc->editor, 'Editor'); |
| 42 | ok(!$doc->text_type, 'Text Type'); |
| 43 | ok(!$doc->text_type_art, 'Text Type Art'); |
| 44 | ok(!$doc->text_type_ref, 'Text Type Ref'); |
| 45 | ok(!$doc->text_column, 'Text Column'); |
| 46 | ok(!$doc->text_domain, 'Text Domain'); |
| 47 | ok(!$doc->creation_date, 'Creation Date'); |
| 48 | ok(!$doc->license, 'License'); |
| 49 | ok(!$doc->pages, 'Pages'); |
| 50 | ok(!$doc->file_edition_statement, 'File Edition Statement'); |
| 51 | ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement'); |
| 52 | ok(!$doc->reference, 'Reference'); |
| 53 | |
| 54 | ok(!$doc->doc_editor, 'Doc: editor'); |
| 55 | ok(!$doc->doc_author, 'Doc: author'); |
| 56 | |
| 57 | ok(!$doc->corpus_title, 'Corpus: title'); |
| 58 | ok(!$doc->corpus_sub_title, 'Corpus: subtitle'); |
| 59 | ok(!$doc->corpus_editor, 'Corpus: editor'); |
| 60 | ok(!$doc->corpus_author, 'Corpus: author'); |
Akron | b2636cf | 2016-01-26 18:42:44 +0100 | [diff] [blame] | 61 | |
Akron | 12ef05b | 2016-01-31 23:58:53 +0100 | [diff] [blame] | 62 | my $hash = $doc->to_hash; |
| 63 | is($hash->{title}, 'Sommerüberraschung', 'Corpus title'); |
| 64 | is($hash->{store}->{sgbrAuthorSex}, 'M', 'store'); |
| 65 | |
Akron | b2636cf | 2016-01-26 18:42:44 +0100 | [diff] [blame] | 66 | done_testing; |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 67 | |
| 68 | |
| 69 | __END__ |