summaryrefslogtreecommitdiffstats
path: root/t/gettextize.t
blob: f49070733491be5672a60d702e841c5d716c77fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/perl
# po4a-gettextize tester.

#########################

use strict;
use warnings;

use lib q(t);
use Testhelper;

my @tests;

my $diff_pod_flags = " -I 'This file was generated by po4a' ";

# msginit annoyances, see https://github.com/mquinson/po4a/issues/338
my $PODIFF =
    "-I'^\"Project-Id-Version:' -I'^\"POT-Creation-Date:' -I'^\"PO-Revision-Date:' "
  . "-I'^# [^[:blank:]]* translations for ' -I'^# Language [^[:blank:]]* translations for ' -I'Copyright (C) 20.. Free Software Foundation, Inc.' -I'^# This file is distributed under the same license as the' -I'^# Automatically generated, 20...' ";

$PODIFF .= " -I ^#:";

push @tests,
  {
    'run' =>
      "cd tmp ; perl ../../po4a-gettextize -f text -o markdown -m ../gettextize/test_ok.md -l ../gettextize/TEST_OK.md -p ./generated.po 2> ./err",
    'tests' => [ "diff $PODIFF -u gettextize/test_ok.po tmp/generated.po", "diff -u gettextize/test_ok.err tmp/err" ],
    'doc'   => "Gettextize a simple file.",
  },
  {
    'run' =>
      "cd tmp ; perl ../../po4a-gettextize -f text -o markdown -m ../gettextize/test_dups.md -l ../gettextize/TEST_OK.md -p ./generated.po 2> ./err",
    'tests' =>
      [ "diff $PODIFF -u gettextize/test_dups.po tmp/generated.po", "diff -u gettextize/test_dups.err tmp/err" ],
    'doc' => "Gettextize a file with dupplicate entries.",
  };

run_all_tests(@tests);
0;