blob: de0c65e70c41acc55e02d811d25243ddf633160b [file] [log] [blame]
use strict;
use warnings;
use Test::More;
use Test::XML::Loy;
use FindBin;
BEGIN {
unshift @INC, "$FindBin::Bin/../lib";
};
use_ok('Test::KorAP::XML::TEI','korap_tempfile', 'i5_template');
subtest 'korap_tempfile' => sub {
my ($fh, $filename) = korap_tempfile('test');
ok($fh, 'Filehandle created');
ok($filename, 'Filename returned');
close($fh);
like($filename, qr!KorAP-XML-TEI_test_.+?\.tmp$!, 'Filename pattern');
($fh, $filename) = korap_tempfile();
ok($fh, 'Filehandle created');
ok($filename, 'Filename returned');
close($fh);
like($filename, qr!KorAP-XML-TEI_.+?\.tmp$!, 'Filename pattern');
};
subtest 'i5_template' => sub {
my $tpl = i5_template();
my $t = Test::XML::Loy->new($tpl);
$t->text_is('korpusSigle', 'AAA')
->text_is('dokumentSigle', 'AAA/BBB')
->text_is('textSigle', 'AAA/BBB.00000')
->text_like('text', qr!Lorem ipsum!)
;
$tpl = i5_template(
korpusSigle => 'BBB',
dokumentSigle => 'BBB/CCC',
textSigle => 'BBB/CCC.11111',
text => 'Ein Versuch'
);
$t = Test::XML::Loy->new($tpl);
$t->text_is('korpusSigle', 'BBB')
->text_is('dokumentSigle', 'BBB/CCC')
->text_is('textSigle', 'BBB/CCC.11111')
->text_unlike('text', qr!Lorem ipsum!)
->text_like('text', qr!Ein Versuch!)
;
};
done_testing;