Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfilter-8
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test --newline option.
5
6 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
7   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
8   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
9     ac_n= ac_c='
10 ' ac_t='        '
11   else
12     ac_n=-n ac_c= ac_t=
13   fi
14 else
15   ac_n= ac_c='\c' ac_t=
16 fi
17
18 cat <<\EOF > mfi-test8.po
19 # HEADER.
20 #
21 msgid ""
22 msgstr ""
23 "Project-Id-Version: Bonnie Tyler\n"
24 "Content-Type: text/plain; charset=ISO-8859-1\n"
25 "Content-Transfer-Encoding: 8bit\n"
26
27 #: married-men:4
28 #, fuzzy
29 msgid "The world is full of married men"
30 msgstr "So viele verheiratete Männer"
31
32 #: married-men:5
33 msgid "with wives who never understand"
34 msgstr "und ihre Frauen verstehen sie nicht"
35
36 #: married-men:6
37 msgid "They're looking for someone to share"
38 msgstr ""
39
40 # schwer zu übersetzen...
41 #: married-men:7
42 msgid "the excitement of a love affair"
43 msgstr ""
44
45 #: married-men:8
46 msgid "Just as soon as they find you"
47 msgstr ""
48
49 #: married-men:9
50 msgid "They warn you and darn you"
51 msgstr ""
52
53 #~ msgid "You fly on the wings of romance"
54 #~ msgstr "Die Flügel der frischen Liebe heben dich zum Himmel"
55
56 #, fuzzy
57 #~ msgid "In the eyes of the world"
58 #~ msgstr "Für die anderen"
59
60 # Etwas freie Übersetzung.
61 #~ msgid "You're just another crazy girl"
62 #~ msgstr "bist du bloß ein verrücktes dummes Ding"
63
64 #~ msgid "Who loves a married man"
65 #~ msgstr "das einen verheirateten Mann liebt"
66 EOF
67
68 cat <<\EOF > filter.sh
69 #!/bin/sh
70 cat
71 if test "$MSGFILTER_MSGID" = "the excitement of a love affair"; then
72   echo $ac_n "non-terminated line$ac_c"
73 else
74   echo terminated line
75 fi
76 EOF
77
78 : ${MSGFILTER=msgfilter}
79 : ${CONFIG_SHELL=${SHELL-/bin/sh}}
80 LC_ALL=C ${MSGFILTER} --newline -i mfi-test8.po -o mfi-test8.out \
81       ${CONFIG_SHELL} filter.sh >mfi-test8.err 2>&1
82 result=$?
83 cat mfi-test8.err | grep -v 'warning: Locale charset' | grep -v '^ '
84 test $result = 0 || { exit 1; }
85 cat mfi-test8.err | grep 'msgfilter: filter output is not terminated with a newline' >/dev/null
86 test $result = 0 || { exit 1; }
87
88 cat <<\EOF > mfi-test8.ok
89 # HEADER.
90 #
91 msgid ""
92 msgstr ""
93 "Project-Id-Version: Bonnie Tyler\n"
94 "Content-Type: text/plain; charset=ISO-8859-1\n"
95 "Content-Transfer-Encoding: 8bit\n"
96 "\n"
97 "terminated line"
98
99 #: married-men:4
100 #, fuzzy
101 msgid "The world is full of married men"
102 msgstr ""
103 "So viele verheiratete Männer\n"
104 "terminated line"
105
106 #: married-men:5
107 msgid "with wives who never understand"
108 msgstr ""
109 "und ihre Frauen verstehen sie nicht\n"
110 "terminated line"
111
112 #: married-men:6
113 msgid "They're looking for someone to share"
114 msgstr ""
115 "\n"
116 "terminated line"
117
118 # schwer zu übersetzen...
119 #: married-men:7
120 msgid "the excitement of a love affair"
121 msgstr ""
122 "\n"
123 "non-terminated line"
124
125 #: married-men:8
126 msgid "Just as soon as they find you"
127 msgstr ""
128 "\n"
129 "terminated line"
130
131 #: married-men:9
132 msgid "They warn you and darn you"
133 msgstr ""
134 "\n"
135 "terminated line"
136
137 #~ msgid "You fly on the wings of romance"
138 #~ msgstr ""
139 #~ "Die Flügel der frischen Liebe heben dich zum Himmel\n"
140 #~ "terminated line"
141
142 #, fuzzy
143 #~ msgid "In the eyes of the world"
144 #~ msgstr ""
145 #~ "Für die anderen\n"
146 #~ "terminated line"
147
148 # Etwas freie Übersetzung.
149 #~ msgid "You're just another crazy girl"
150 #~ msgstr ""
151 #~ "bist du bloß ein verrücktes dummes Ding\n"
152 #~ "terminated line"
153
154 #~ msgid "Who loves a married man"
155 #~ msgstr ""
156 #~ "das einen verheirateten Mann liebt\n"
157 #~ "terminated line"
158 EOF
159
160 : ${DIFF=diff}
161 ${DIFF} mfi-test8.ok mfi-test8.out
162 result=$?
163
164 exit $result