Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfilter-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test general filter execution.
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 # Some fold programs (like SunOS4 and FreeBSD) don't have an option to wrap at
19 # spaces.
20 echo 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.
26 echo 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.
33 foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c`
34 foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[  ]//g'`
35 test "$foldoutputcount" = 3 || {
36   echo "Skipping test: fold program inserts extra newline"
37   exit 77
38 }
39
40 cat <<\EOF > mfi-test1.po
41 # HEADER.
42 #
43 msgid ""
44 msgstr ""
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
51 msgid "The world is full of married men"
52 msgstr "So viele verheiratete Männer"
53
54 #: married-men:5
55 msgid "with wives who never understand"
56 msgstr "und ihre Frauen verstehen sie nicht"
57
58 #: married-men:6
59 msgid "They're looking for someone to share"
60 msgstr ""
61
62 # schwer zu übersetzen...
63 #: married-men:7
64 msgid "the excitement of a love affair"
65 msgstr ""
66
67 #: married-men:8
68 msgid "Just as soon as they find you"
69 msgstr ""
70
71 #: married-men:9
72 msgid "They warn you and darn you"
73 msgstr ""
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"
88 EOF
89
90 : ${MSGFILTER=msgfilter}
91 LC_ALL=C \
92 ${MSGFILTER} -i mfi-test1.po -o mfi-test1.out fold -b -s -w 20 >mfi-test1.err 2>&1
93 result=$?
94 cat mfi-test1.err | grep -v 'warning: Locale charset' | grep -v '^ '
95 test $result = 0 || { exit 1; }
96
97 cat <<\EOF > mfi-test1.ok
98 # HEADER.
99 #
100 msgid ""
101 msgstr ""
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
112 msgid "The world is full of married men"
113 msgstr ""
114 "So viele \n"
115 "verheiratete Männer"
116
117 #: married-men:5
118 msgid "with wives who never understand"
119 msgstr ""
120 "und ihre Frauen \n"
121 "verstehen sie nicht"
122
123 #: married-men:6
124 msgid "They're looking for someone to share"
125 msgstr ""
126
127 # schwer zu übersetzen...
128 #: married-men:7
129 msgid "the excitement of a love affair"
130 msgstr ""
131
132 #: married-men:8
133 msgid "Just as soon as they find you"
134 msgstr ""
135
136 #: married-men:9
137 msgid "They warn you and darn you"
138 msgstr ""
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"
163 EOF
164
165 : ${DIFF=diff}
166 ${DIFF} mfi-test1.ok mfi-test1.out
167 result=$?
168
169 exit $result