Koha/t/db_dependent/misc/translator/xgettext-installer.t
Jonathan Druart fbbd169504 Bug 25067: Adjust paths in tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-06 16:59:40 +01:00

32 lines
818 B
Perl
Executable file

#!/usr/bin/perl
use Modern::Perl;
use File::Slurp;
use File::Temp qw(tempdir);
use FindBin qw($Bin);
use Locale::PO;
use Test::More tests => 4;
my $tempdir = tempdir(CLEANUP => 1);
write_file("$tempdir/files", "$Bin/sample.yml");
my $xgettext_cmd = "$Bin/../../../../misc/translator/xgettext-installer "
. "-o $tempdir/Koha.pot -f $tempdir/files";
system($xgettext_cmd);
my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
my @expected = (
{ msgid => '"Sample installer file"' },
{ msgid => '"bar"' },
{ msgid => '"baz"' },
{ msgid => '"foo ツ"' },
);
for (my $i = 0; $i < @expected; $i++) {
my $expected = $expected[$i]->{msgid};
my $expected_str = defined $expected ? $expected : 'not defined';
is($pot->[$i + 1]->msgid, $expected, "$i: msgid is $expected_str");
}