Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-15
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test plural formula dependent checking of format strings.
5
6 # Take as example a plural formula which takes the values 0 and 2 infinitely
7 # often, and value 1 only a few times.
8 # Test: 1 - have %d everywhere - OK
9 #       2 - lack %d for value 0 - error
10 #       3 - lack %d for value 1 - OK
11 #       4 - lack %d for value 2 - error
12
13 cat <<\EOF > mf-15.po1
14 # SOME DESCRIPTIVE TITLE.
15 # Copyright (C) YEAR Free Software Foundation, Inc.
16 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
17 #
18 msgid ""
19 msgstr ""
20 "Project-Id-Version: GNU bison\n"
21 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
22 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
23 "Language-Team: test <test@li.org>\n"
24 "Language: test\n"
25 "MIME-Version: 1.0\n"
26 "Content-Type: text/plain; charset=UTF-8\n"
27 "Content-Transfer-Encoding: 8bit\n"
28 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
29
30 #: src/reduce.c:511
31 #, c-format
32 msgid "%d useless nonterminal"
33 msgid_plural "%d useless nonterminals"
34 msgstr[0] "%d unnütze Nichtterminale"
35 msgstr[1] "%d unnützes Nichtterminal"
36 msgstr[2] "%d der unnützen Nichtterminale"
37 EOF
38
39 : ${MSGFMT=msgfmt}
40 ${MSGFMT} --check -o /dev/null mf-15.po1 || exit 1
41
42 cat <<\EOF > mf-15.po2
43 # SOME DESCRIPTIVE TITLE.
44 # Copyright (C) YEAR Free Software Foundation, Inc.
45 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
46 #
47 msgid ""
48 msgstr ""
49 "Project-Id-Version: GNU bison\n"
50 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
51 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
52 "Language-Team: test <test@li.org>\n"
53 "Language: test\n"
54 "MIME-Version: 1.0\n"
55 "Content-Type: text/plain; charset=UTF-8\n"
56 "Content-Transfer-Encoding: 8bit\n"
57 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
58
59 #: src/reduce.c:511
60 #, c-format
61 msgid "%d useless nonterminal"
62 msgid_plural "%d useless nonterminals"
63 msgstr[0] "unnütze Nichtterminale"
64 msgstr[1] "%d unnützes Nichtterminal"
65 msgstr[2] "%d der unnützen Nichtterminale"
66 EOF
67
68 : ${MSGFMT=msgfmt}
69 ${MSGFMT} --check -o /dev/null mf-15.po2 2>/dev/null
70 test $? = 1 || { exit 1; }
71
72 cat <<\EOF > mf-15.po3
73 # SOME DESCRIPTIVE TITLE.
74 # Copyright (C) YEAR Free Software Foundation, Inc.
75 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
76 #
77 msgid ""
78 msgstr ""
79 "Project-Id-Version: GNU bison\n"
80 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
81 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
82 "Language-Team: test <test@li.org>\n"
83 "Language: test\n"
84 "MIME-Version: 1.0\n"
85 "Content-Type: text/plain; charset=UTF-8\n"
86 "Content-Transfer-Encoding: 8bit\n"
87 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
88
89 #: src/reduce.c:511
90 #, c-format
91 msgid "%d useless nonterminal"
92 msgid_plural "%d useless nonterminals"
93 msgstr[0] "%d unnütze Nichtterminale"
94 msgstr[1] "unnützes Nichtterminal"
95 msgstr[2] "%d der unnützen Nichtterminale"
96 EOF
97
98 : ${MSGFMT=msgfmt}
99 ${MSGFMT} --check -o /dev/null mf-15.po3 || exit 1
100
101 cat <<\EOF > mf-15.po4
102 # SOME DESCRIPTIVE TITLE.
103 # Copyright (C) YEAR Free Software Foundation, Inc.
104 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
105 #
106 msgid ""
107 msgstr ""
108 "Project-Id-Version: GNU bison\n"
109 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
110 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
111 "Language-Team: test <test@li.org>\n"
112 "Language: test\n"
113 "MIME-Version: 1.0\n"
114 "Content-Type: text/plain; charset=UTF-8\n"
115 "Content-Transfer-Encoding: 8bit\n"
116 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
117
118 #: src/reduce.c:511
119 #, c-format
120 msgid "%d useless nonterminal"
121 msgid_plural "%d useless nonterminals"
122 msgstr[0] "%d unnütze Nichtterminale"
123 msgstr[1] "%d unnützes Nichtterminal"
124 msgstr[2] "der unnützen Nichtterminale"
125 EOF
126
127 : ${MSGFMT=msgfmt}
128 ${MSGFMT} --check -o /dev/null mf-15.po4 2>/dev/null
129 test $? = 1 || { exit 1; }
130
131 exit $result