Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-php-4
1 #!/bin/sh
2
3 # Test PHP support: string concatenation.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-ph-4.php"
9 cat <<EOF > xg-ph-4.php
10 <?
11 echo _("foo"."bar");
12 echo _("hello " .
13 "world");
14 echo _("1" + "2" . "3");
15 echo _("4" . "5" + "6");
16 echo _("7" . "8" . "9");
17 ?>
18 EOF
19
20 tmpfiles="$tmpfiles xg-ph-4.tmp.po xg-ph-4.po"
21 : ${XGETTEXT=xgettext}
22 ${XGETTEXT} --omit-header --no-location --extract-all \
23   -d xg-ph-4.tmp xg-ph-4.php
24 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
25 LC_ALL=C tr -d '\r' < xg-ph-4.tmp.po > xg-ph-4.po
26 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
27
28 tmpfiles="$tmpfiles xg-ph-4.ok"
29 cat <<EOF > xg-ph-4.ok
30 msgid "foobar"
31 msgstr ""
32
33 msgid "hello world"
34 msgstr ""
35
36 msgid "1"
37 msgstr ""
38
39 msgid "2"
40 msgstr ""
41
42 msgid "3"
43 msgstr ""
44
45 msgid "45"
46 msgstr ""
47
48 msgid "6"
49 msgstr ""
50
51 msgid "789"
52 msgstr ""
53 EOF
54
55 : ${DIFF=diff}
56 ${DIFF} xg-ph-4.ok xg-ph-4.po
57 result=$?
58
59 rm -fr $tmpfiles
60
61 exit $result