1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test general filter execution.
5
6if (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
14else
15  ac_n= ac_c='\c' ac_t=
16fi
17
18# Some fold programs (like SunOS4 and FreeBSD) don't have an option to wrap at
19# spaces.
20echo abc | fold -b -s -w 20 >/dev/null 2>&1 || {
21  echo "Skipping test: fold program not POSIX compliant"
22  Exit 77
23}
24
25# Some fold programs (like NetBSD 5.0) remove trailing spaces when wrapping.
26echo ab cd | fold -b -s -w 3 | grep ' ' >/dev/null || {
27  echo "Skipping test: fold program trims trailing spaces"
28  Exit 77
29}
30
31# Some fold programs (like HP-UX) insert a newline at the end, if the last
32# line was not terminated with a newline and the -s option was given.
33foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c`
34foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[ 	]//g'`
35test "$foldoutputcount" = 3 || {
36  echo "Skipping test: fold program inserts extra newline"
37  Exit 77
38}
39
40cat <<\EOF > mfi-test1.po
41# HEADER.
42#
43msgid ""
44msgstr ""
45"Project-Id-Version: Bonnie Tyler\n"
46"Content-Type: text/plain; charset=ISO-8859-1\n"
47"Content-Transfer-Encoding: 8bit\n"
48
49#: married-men:4
50#, fuzzy
51msgid "The world is full of married men"
52msgstr "So viele verheiratete M�nner"
53
54#: married-men:5
55msgid "with wives who never understand"
56msgstr "und ihre Frauen verstehen sie nicht"
57
58#: married-men:6
59msgid "They're looking for someone to share"
60msgstr ""
61
62# schwer zu �bersetzen...
63#: married-men:7
64msgid "the excitement of a love affair"
65msgstr ""
66
67#: married-men:8
68msgid "Just as soon as they find you"
69msgstr ""
70
71#: married-men:9
72msgid "They warn you and darn you"
73msgstr ""
74
75#~ msgid "You fly on the wings of romance"
76#~ msgstr "Die Fl�gel der frischen Liebe heben dich zum Himmel"
77
78#, fuzzy
79#~ msgid "In the eyes of the world"
80#~ msgstr "F�r die anderen"
81
82# Etwas freie �bersetzung.
83#~ msgid "You're just another crazy girl"
84#~ msgstr "bist du blo� ein verr�cktes dummes Ding"
85
86#~ msgid "Who loves a married man"
87#~ msgstr "das einen verheirateten Mann liebt"
88EOF
89
90: ${MSGFILTER=msgfilter}
91LC_ALL=C \
92${MSGFILTER} -i mfi-test1.po -o mfi-test1.out fold -b -s -w 20 >mfi-test1.err 2>&1
93result=$?
94cat mfi-test1.err | grep -v 'warning: Locale charset' | grep -v '^ '
95test $result = 0 || { Exit 1; }
96
97cat <<\EOF > mfi-test1.ok
98# HEADER.
99#
100msgid ""
101msgstr ""
102"Project-Id-Version: \n"
103"Bonnie Tyler\n"
104"Content-Type: \n"
105"text/plain; \n"
106"charset=ISO-8859-1\n"
107"Content-Transfer-Enc\n"
108"oding: 8bit\n"
109
110#: married-men:4
111#, fuzzy
112msgid "The world is full of married men"
113msgstr ""
114"So viele \n"
115"verheiratete M�nner"
116
117#: married-men:5
118msgid "with wives who never understand"
119msgstr ""
120"und ihre Frauen \n"
121"verstehen sie nicht"
122
123#: married-men:6
124msgid "They're looking for someone to share"
125msgstr ""
126
127# schwer zu �bersetzen...
128#: married-men:7
129msgid "the excitement of a love affair"
130msgstr ""
131
132#: married-men:8
133msgid "Just as soon as they find you"
134msgstr ""
135
136#: married-men:9
137msgid "They warn you and darn you"
138msgstr ""
139
140#~ msgid "You fly on the wings of romance"
141#~ msgstr ""
142#~ "Die Fl�gel der \n"
143#~ "frischen Liebe \n"
144#~ "heben dich zum \n"
145#~ "Himmel"
146
147#, fuzzy
148#~ msgid "In the eyes of the world"
149#~ msgstr "F�r die anderen"
150
151# Etwas freie �bersetzung.
152#~ msgid "You're just another crazy girl"
153#~ msgstr ""
154#~ "bist du blo� ein \n"
155#~ "verr�cktes dummes \n"
156#~ "Ding"
157
158#~ msgid "Who loves a married man"
159#~ msgstr ""
160#~ "das einen \n"
161#~ "verheirateten Mann \n"
162#~ "liebt"
163EOF
164
165: ${DIFF=diff}
166${DIFF} mfi-test1.ok mfi-test1.out
167result=$?
168
169exit $result
170