summaryrefslogtreecommitdiffstats
path: root/t/cfg-args.t
blob: aad779dcbbd8a58fe0dbd25535090a6920556faf (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
#! /usr/bin/perl
# config file tester.

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

use strict;
use warnings;

use lib q(t);
use Testhelper;

# TODO: alias option overriding generic option
# TODO: file-specific overriding alias option

my @tests;
push @tests, {
    'doc'            => '-k 20 in global options',
    'po4a.conf'      => 'cfg/args-global/po4a.conf',
    'modes'          => 'dstdir',                               # no need to test every mode
    'options'        => '--no-update',                          # no need for the produced po files
    'expected_files' => 'man.de.1 man.es.1 man.fr.1 man.it.1'

  },
  {
    'doc'              => '-k 100 on command line >> -k 20 in global options',
    'po4a.conf'        => 'cfg/args-global/po4a.conf',
    'modes'            => 'dstdir',
    'options'          => '--no-update --keep 100',
    'expected_outfile' => '_output-keep100',
    'expected_files'   => 'man.it.1'

  },
  {
    'doc'            => '-k 0 in type alias',
    'po4a.conf'      => 'cfg/args-alias/po4a.conf',
    'modes'          => 'dstdir',
    'options'        => '--no-update',
    'expected_files' => 'man.de.1 man.fr.1 man.fr.2 man.it.1 man.it.2'
  },
  {
    'doc'              => '-k 100 on command line >> -k 0 in type alias',
    'po4a.conf'        => 'cfg/args-alias/po4a.conf',
    'modes'            => 'dstdir',
    'options'          => '--no-update --keep 100',
    'expected_outfile' => '_output-keep100',
    'expected_files'   => 'man.it.1 man.it.2'

  },
  {
    'doc'            => '-k 0 in type alias, but with a redefinition of the same alias',
    'po4a.conf'      => 'cfg/args-alias-redef/po4a.conf',
    'modes'          => 'dstdir',
    'options'        => '--no-update',
    'expected_files' => 'man.de.1 man.fr.1 man.it.1'
  },
  {
    'doc'            => '-k 40 in master doc',
    'po4a.conf'      => 'cfg/args-master/po4a.conf',
    'modes'          => 'dstdir',
    'options'        => '--no-update',
    'expected_files' => 'man.fr.1 man.it.1'
  },
  {
    'doc'              => '-k 100 on command line >> -k 40 in master doc',
    'po4a.conf'        => 'cfg/args-master/po4a.conf',
    'modes'            => 'dstdir',
    'options'          => '--no-update --keep 100',
    'expected_outfile' => '_output-keep100',
    'expected_files'   => 'man.it.1'
  },
  {
    'doc'            => 'spaces in the directory and file names',
    'po4a.conf'      => 'cfg/space_in_name/po4a.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'some\ directory space\ in\ name.fr.po  space\ in\ name.pot',
  },
  {
    'doc'            => 'Just like single-uptodate, but with the config file in DOS encoding',
    'po4a.conf'      => 'cfg/windows-CRLF/windows-CRLF.conf',
    'closed_path'    => 'cfg/*/',
    'expected_files' => 'single-uptodate.fr.po  single-uptodate.pot single-uptodate.man.fr.1',

  };

run_all_tests(@tests);

0;