Add proper test for 3384
Change-Id: I9ba242a27a05fcb4878b9cee544c3d898ce61ec3
diff --git a/lib/Test/KorAP/XML/TEI.pm b/lib/Test/KorAP/XML/TEI.pm
index fa94273..1581136 100644
--- a/lib/Test/KorAP/XML/TEI.pm
+++ b/lib/Test/KorAP/XML/TEI.pm
@@ -221,6 +221,19 @@
};
+# Get content of a file
+sub get_content_of {
+ my ($self, $file) = @_;
+ if (my $zip = IO::Uncompress::Unzip->new(\$self->{stdout}, Name => $file)) {
+ my $data = '';
+ $data .= $zip->getline while !$zip->eof;
+ $zip->close;
+ return $data;
+ };
+ return '';
+};
+
+
# Returns an Test::XML::Loy object
sub unzip_xml {
my ($self, $file) = @_;
diff --git a/script/tei2korapxml b/script/tei2korapxml
index 0912d30..9ce2c8e 100755
--- a/script/tei2korapxml
+++ b/script/tei2korapxml
@@ -160,7 +160,7 @@
my $dir; # text directory (below $_root_dir)
-my ( $text_id, $text_id_esc ); # '$text_id_esc' = escaped version of $text_id (see %ent)
+my ( $text_id, $text_id_esc ); # '$text_id_esc' = escaped version of $text_id
my ( $reader, # instance of 'XML::LibXML::Reader->new' (on input '$buf_in')
$tree_data ); # instance of 'XML::CompactTree::XS::readSubtreeToPerl' (on input '$reader')
diff --git a/t/script.t b/t/script.t
index 9521d73..e9d9dc9 100644
--- a/t/script.t
+++ b/t/script.t
@@ -69,6 +69,9 @@
->text_like('raw_text > text', qr!^Campagne in Frankreich 1792.*?uns allein begl.*cke\.$!, 'text content')
->text_like('raw_text > text', qr!unter dem Titel "Kriegstheater"!, 'text content');
+ my $content = $t->get_content_of('GOE/AGA/00000/data.xml');
+ like($content, qr!unter dem Titel "Kriegstheater"!, 'raw text content');
+
$t->unzip_xml('GOE/AGA/00000/struct/structure.xml')
->text_is('span[id=s3] *[name=type]', 'Autobiographie', 'text content')
->text_is('#s3 *[name=type]', 'Autobiographie', 'text content')