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