blob: e6ce10a107097bea5d60e650b3aac8d1dbb7887b [file] [log] [blame]
Akron2e840a72022-02-03 09:49:26 +01001use strict;
2use warnings;
3use Test::More;
4use Data::Dumper;
5use JSON::XS;
6
7if ($ENV{SKIP_REAL}) {
8 plan skip_all => 'Skip real tests';
9};
10
11use utf8;
12use lib 'lib', '../lib';
13
14use File::Basename 'dirname';
15use File::Spec::Functions 'catdir';
16
17use_ok('KorAP::XML::Krill');
18
19my $path = catdir(dirname(__FILE__), 'corpus','NDY','296','008718');
20
21ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
22ok($doc->parse, 'Parse document');
23
24is($doc->text_sigle, 'NDY/296/008718', 'Correct text sigle');
25is($doc->doc_sigle, 'NDY/296', 'Correct document sigle');
26is($doc->corpus_sigle, 'NDY', 'Correct corpus sigle');
27
28my $meta = $doc->meta;
29
30like($meta->{T_title}, qr!^Kommentar zu: LOCKE hat mein MERCEDES AMG ZERSTÖRT!, 'Title');
31ok(!$meta->{T_sub_title}, 'SubTitle');
32is($meta->{T_author}, 'Livia Banse', 'Author');
33ok(!$meta->{A_editor}, 'Editor');
34is($meta->{S_pub_place}, 'San Bruno, California');
35is($meta->{A_publisher}, 'YouTube', 'Publisher');
36
37is($meta->{S_text_type},'Kurzmeldungen: YouTube-Kommentare', 'No Text Type');
38ok(!$meta->{S_text_type_art}, 'No Text Type Art');
39ok(!$meta->{S_text_type_ref}, 'No Text Type Ref');
40ok(!$meta->{S_text_domain}, 'No Text Domain');
41ok(!$meta->{S_text_column}, 'No Text Column');
42
43is($meta->{K_text_class}->[0], 'entertainment', 'Correct Text Class');
44ok(!$meta->{K_text_class}->[1], 'Correct Text Class');
45
46is($meta->{D_pub_date}, '20171204', 'Creation date');
47is($meta->{D_creation_date}, '20171204', 'Creation date');
48is($meta->{S_availability}, 'QAO-NC-LOC:ids', 'License');
49ok(!$meta->{A_pages}, 'Pages');
50
51ok(!$meta->{A_file_edition_statement}, 'File Statement');
52ok(!$meta->{A_bibl_edition_statement}, 'Bibl Statement');
53
54like($meta->{A_reference}, qr!NDY\/296\.008718, YouTube, 04\.12\.2017\. Livia Banse: Kommentar zu: LOCKE hat mein MERCEDES AMG ZERSTÖRT.* \(AutoUnfall\), - YouTube!, 'Reference');
55
56is($meta->{S_language}, 'de', 'Language');
57
58is($meta->{T_corpus_title}, 'YouTube', 'Correct Corpus title');
59ok(!$meta->{T_corpus_sub_title}, 'Correct Corpus sub title');
60ok(!$meta->{T_corpus_author}, 'Correct Corpus author');
61ok(!$meta->{A_corpus_editor}, 'Correct Corpus editor');
62
63like($meta->{T_doc_title}, qr!LOCKE hat mein MERCEDES AMG ZERSTÖRT\!.* \(AutoUnfall\)!, 'Correct Doc title');
64ok(!$meta->{T_doc_sub_title}, 'Correct Doc sub title');
65is($meta->{T_doc_author},'Leon Machère', 'Correct Doc author');
66ok(!$meta->{A_doc_editor}, 'Correct doc editor');
67
68
Akron2e840a72022-02-03 09:49:26 +010069done_testing;
70__END__