summaryrefslogtreecommitdiffstats
path: root/t/cfg-single.t
blob: 8ff5f1c3736747f6ccbc818c92c7f2344d82d0f1 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#! /usr/bin/perl
# config file tester.

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

use strict;
use warnings;

use lib q(t);
use Testhelper;

my @tests;
push @tests, {
    'doc'            => 'Single language, no pot no po',
    'po4a.conf'      => 'cfg/single-nopotpo/po4a.conf',
    'closed_path'    => 'cfg/*/',                          # Do not use or modify the other tests
    'expected_files' => 'single.fr.po  single.pot',
  },
  {
    'doc'            => 'Single language, no po',
    'po4a.conf'      => 'cfg/single-nopo/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single.fr.po  single.pot',
  },
  {
    'doc'              => 'Single language, no po, --no-update',
    'po4a.conf'        => 'cfg/single-nopo/po4a.conf',
    'options'          => ' --no-update',
    'closed_path'      => 'cfg/*/',
    'expected_outfile' => 'cfg/single-nopo/_output-noupdate',
    'expected_files'   => '',

  },
  {
    'doc'            => 'Single language, with translation to create',
    'po4a.conf'      => 'cfg/single/single.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single.fr.po  single.pot single.man.fr.1',

  },
  {
    'doc'            => 'Single language, translation uptodate',
    'po4a.conf'      => 'cfg/single-uptodate/single-uptodate.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single-uptodate.fr.po  single-uptodate.pot single-uptodate.man.fr.1',

  },
  {
    'doc'            => 'Single language, translation already fuzzy',
    'po4a.conf'      => 'cfg/single-fuzzy/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single-fuzzy.fr.po single-fuzzy.pot',

  },
  {
    'doc'            => 'Single language, translation fuzzied during the update',
    'po4a.conf'      => 'cfg/single-fuzzied/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single-fuzzied.fr.po single-fuzzied.pot',

  },
  {
    'doc'            => 'Single language, translation would be fuzzied if --no-update were not given',
    'po4a.conf'      => 'cfg/single-fuzzied-noup/po4a.conf',
    'options'        => '--no-update',
    'closed_path'    => 'cfg/*/',
    'expected_files' => '',

  },
  {
    'doc'            => 'Single language, with a new string appearing in the master doc',
    'po4a.conf'      => 'cfg/single-newstr/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single-newstr.fr.po single-newstr.pot single-newstr.man.fr.1',
  },
  {
    'doc'              => 'Single language, with a validation error reported by msgfmt',
    'po4a.conf'        => 'cfg/single-invalid/po4a.conf',
    'closed_path'      => 'cfg/*/',
    'expected_retcode' => 256,
    'expected_files'   => 'single.fr.po single.pot',
  },
  {
    'doc'            => 'Single language, with a separate pot_in file',
    'po4a.conf'      => 'cfg/single-potin/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single.man.fr.1 single.fr.po single.pot',
  },
  {
    'doc'            => 'Single language, using po_directory in the config file',
    'po4a.conf'      => 'cfg/single-podirectory/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'po single.man.fr.1',
    'tests'          => [
        'PODIFF -I#: $path/po/fr.po $tmppath/po/fr.po',    #
        'PODIFF -I#: $path/po/single.pot $tmppath/po/single.pot'
    ]
  },
  {
    'doc'            => 'Single language, using po_directory in the config file, empty POT, no PO',
    'po4a.conf'      => 'cfg/single-podirectory-emptypot-emptypo/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'fr.po  single.pot',
    'tests'          => [
        'PODIFF -I#: $path/_fr.po.expected $tmppath/fr.po',       #
        'PODIFF -I#: $path/_single.pot.expected $tmppath/single.pot',
        'rm $tmppath/single.pot && touch $tmppath/single.pot',    # This file is empty on purpose
        'rm $tmppath/fr.po && touch $tmppath/fr.po',              # This file is empty on purpose
    ]

  },
  {
    'doc'            => 'Single language, using po_directory in the config file, empty POT file',
    'po4a.conf'      => 'cfg/single-podirectory-emptypot/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'po single.man.fr.1',
    'tests'          => [
        'PODIFF -I#: $path/po/fr.po $tmppath/po/fr.po',           #
        'PODIFF -I#: $path/_single.pot $tmppath/po/single.pot',
        'rm $tmppath/po/single.pot && touch $tmppath/po/single.pot'
        ,    # The $path/po/single.pot exists, but it's empty (on purpose)
    ]
  },
  {
    'doc'            => 'Single language, empty PO file and UTF in msgids (see Debian\'s #1022216)',
    'po4a.conf'      => 'cfg/single-emptypo/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'fr.po single.pot single.man.fr.1',
  };

run_all_tests(@tests);

0;