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
13cat <<\EOF > mf-15.po1
14# SOME DESCRIPTIVE TITLE.
15# Copyright (C) YEAR Free Software Foundation, Inc.
16# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
17#
18msgid ""
19msgstr ""
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
32msgid "%d useless nonterminal"
33msgid_plural "%d useless nonterminals"
34msgstr[0] "%d unnütze Nichtterminale"
35msgstr[1] "%d unnützes Nichtterminal"
36msgstr[2] "%d der unnützen Nichtterminale"
37EOF
38
39: ${MSGFMT=msgfmt}
40${MSGFMT} --check -o /dev/null mf-15.po1 || Exit 1
41
42cat <<\EOF > mf-15.po2
43# SOME DESCRIPTIVE TITLE.
44# Copyright (C) YEAR Free Software Foundation, Inc.
45# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
46#
47msgid ""
48msgstr ""
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
61msgid "%d useless nonterminal"
62msgid_plural "%d useless nonterminals"
63msgstr[0] "unnütze Nichtterminale"
64msgstr[1] "%d unnützes Nichtterminal"
65msgstr[2] "%d der unnützen Nichtterminale"
66EOF
67
68: ${MSGFMT=msgfmt}
69${MSGFMT} --check -o /dev/null mf-15.po2 2>/dev/null
70test $? = 1 || { Exit 1; }
71
72cat <<\EOF > mf-15.po3
73# SOME DESCRIPTIVE TITLE.
74# Copyright (C) YEAR Free Software Foundation, Inc.
75# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
76#
77msgid ""
78msgstr ""
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
91msgid "%d useless nonterminal"
92msgid_plural "%d useless nonterminals"
93msgstr[0] "%d unnütze Nichtterminale"
94msgstr[1] "unnützes Nichtterminal"
95msgstr[2] "%d der unnützen Nichtterminale"
96EOF
97
98: ${MSGFMT=msgfmt}
99${MSGFMT} --check -o /dev/null mf-15.po3 || Exit 1
100
101cat <<\EOF > mf-15.po4
102# SOME DESCRIPTIVE TITLE.
103# Copyright (C) YEAR Free Software Foundation, Inc.
104# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
105#
106msgid ""
107msgstr ""
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
120msgid "%d useless nonterminal"
121msgid_plural "%d useless nonterminals"
122msgstr[0] "%d unnütze Nichtterminale"
123msgstr[1] "%d unnützes Nichtterminal"
124msgstr[2] "der unnützen Nichtterminale"
125EOF
126
127: ${MSGFMT=msgfmt}
128${MSGFMT} --check -o /dev/null mf-15.po4 2>/dev/null
129test $? = 1 || { Exit 1; }
130
131exit $result
132