Akron | 414ec95 | 2020-08-03 15:48:43 +0200 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use utf8; |
| 4 | use Test::More; |
| 5 | use Benchmark ':hireswallclock'; |
| 6 | use Mojo::DOM; |
| 7 | use Mojo::File; |
| 8 | use Mojo::ByteStream 'b'; |
| 9 | use Data::Dumper; |
| 10 | use File::Basename 'dirname'; |
| 11 | use File::Spec::Functions 'catdir'; |
| 12 | use lib 'lib', '../lib'; |
| 13 | |
| 14 | use_ok('KorAP::XML::Krill'); |
| 15 | |
| 16 | # ART |
| 17 | my $path = catdir(dirname(__FILE__), 'corpus','artificial'); |
| 18 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
| 19 | #is($doc->path, $path . '/', 'Path'); |
| 20 | |
| 21 | ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document'); |
| 22 | #is($doc->path, $path . '/', 'Path'); |
| 23 | |
| 24 | ok($doc->parse, 'Parse document'); |
| 25 | |
| 26 | my $meta = $doc->meta; |
| 27 | |
| 28 | # Metdata |
| 29 | is($meta->{T_title}, 'Artificial Title', 'title'); |
| 30 | is($meta->{T_sub_title}, 'Artificial Subtitle', 'subTitle'); |
Akron | aa166fa | 2022-11-10 14:15:14 +0100 | [diff] [blame^] | 31 | is($doc->text_sigle, 'A_RT/ABC/00001', 'ID'); |
| 32 | is($doc->corpus_sigle, 'A_RT', 'corpusID'); |
Akron | 414ec95 | 2020-08-03 15:48:43 +0200 | [diff] [blame] | 33 | is($meta->{D_pub_date}, '20010402', 'pubDate'); |
| 34 | is($meta->{S_pub_place}, 'Mannheim', 'pubPlace'); |
| 35 | is($meta->{S_pub_place_key}, 'DE', 'pubPlace key'); |
| 36 | is($meta->{K_text_class}->[0], 'freizeit-unterhaltung', 'TextClass'); |
| 37 | is($meta->{K_text_class}->[1], 'vereine-veranstaltungen', 'TextClass'); |
| 38 | ok(!$meta->{K_text_class}->[2], 'TextClass'); |
| 39 | #is($doc->author->[0], 'Ruru', 'author'); |
| 40 | #is($doc->author->[1], 'Jens.Ol', 'author'); |
| 41 | #is($doc->author->[2], 'Aglarech', 'author'); |
| 42 | is($meta->{T_author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author'); |
| 43 | |
| 44 | # Additional information |
| 45 | is($meta->{A_editor}, 'Nils Diewald', 'Editor'); |
| 46 | is($meta->{A_publisher}, 'Artificial articles Inc.', 'Publisher'); |
| 47 | is($meta->{D_creation_date}, '19990601', 'Creation date'); |
| 48 | #is($doc->coll_title, 'Artificial articles', 'Collection title'); |
| 49 | #is($doc->coll_sub_title, 'Best of!', 'Collection subtitle'); |
| 50 | #is($doc->coll_editor, 'Nils Diewald', 'Collection editor'); |
| 51 | #is($doc->coll_author, 'Nils Diewald', 'Collection author'); |
| 52 | is($meta->{S_text_type}, 'Zeitung: Tageszeitung', 'No text_type'); |
| 53 | is($meta->{S_text_type_art}, 'Bericht', 'text_type art'); |
| 54 | |
Akron | 8ad06c4 | 2022-01-11 17:07:49 +0100 | [diff] [blame] | 55 | use_ok('KorAP::XML::Meta::I5'); |
| 56 | |
| 57 | $meta = new KorAP::XML::Meta::I5(); |
| 58 | |
| 59 | is('data:application/x.korap-link;example=%20Das%20war%20einfach;title=Hallo%21,https%3A%2F%2Fwww.test.de', |
| 60 | $meta->korap_data_uri('https://www.test.de', title => 'Hallo!', example => ' Das war einfach')); |
| 61 | |
Akron | 414ec95 | 2020-08-03 15:48:43 +0200 | [diff] [blame] | 62 | done_testing; |
| 63 | __END__ |
| 64 | |