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