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