Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-python-4
1 #!/bin/sh
2
3 # Test Python support: --add-comments option.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-py-3.py"
9 cat <<\EOF > xg-py-3.py
10 # a
11 string = # b
12 # c
13 _( # d
14 "hello " "world" # e
15 );
16 EOF
17
18 tmpfiles="$tmpfiles xg-py-3.tmp.po xg-py-3.po"
19 : ${XGETTEXT=xgettext}
20 ${XGETTEXT} --add-comments --omit-header --no-location --keyword=_ \
21   -d xg-py-3.tmp xg-py-3.py
22 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
23 LC_ALL=C tr -d '\r' < xg-py-3.tmp.po > xg-py-3.po
24 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
25
26 tmpfiles="$tmpfiles xg-py-3.ok"
27 cat <<EOF > xg-py-3.ok
28 #. a
29 #. b
30 #. c
31 #. d
32 msgid "hello world"
33 msgstr ""
34 EOF
35
36 : ${DIFF=diff}
37 ${DIFF} xg-py-3.ok xg-py-3.po
38 result=$?
39
40 rm -fr $tmpfiles
41
42 exit $result