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