Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-php-2
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test PHP support: here documents.
5
6 cat <<EOF > xg-ph-2.php
7 <?
8 echo _("Egyptians");
9 echo <<<EOTMARKER
10 Ramses
11 EOTMARKER;
12 echo _("Babylonians");
13 echo <<<EOTMARKER
14 Nebukadnezar
15 EOTMARKER
16 echo _("Assyrians");
17 echo <<<EOTMARKER
18 Assurbanipal
19 EOT
20 echo _("Persians");
21 echo <<<EOTMARKER
22 Darius
23
24 echo _("Greeks");
25 echo <<<EOTMARKER
26 Alexander
27
28 EOTMARKER
29 echo _("Romans");
30 echo <<<EOTMARKER
31 Augustus
32   EOTMARKER
33 echo _("Goths");
34 echo <<<EOTMARKER
35 Odoakar
36 Theoderich
37 EOTMARKER
38 echo _("Franks");
39 ?>
40 EOF
41
42 : ${XGETTEXT=xgettext}
43 ${XGETTEXT} --omit-header --no-location -d xg-ph-2.tmp xg-ph-2.php || exit 1
44 LC_ALL=C tr -d '\r' < xg-ph-2.tmp.po > xg-ph-2.po || exit 1
45
46 sed 's!<<<EOTMARKER!<<<"EOTMARKER"!' xg-ph-2.php > xg-ph-2d.php || exit 1
47 sed "s!<<<EOTMARKER!<<<'EOTMARKER'!" xg-ph-2.php > xg-ph-2s.php || exit 1
48
49 : ${XGETTEXT=xgettext}
50
51 ${XGETTEXT} --omit-header --no-location -d xg-ph-2.tmp xg-ph-2.php || exit 1
52 LC_ALL=C tr -d '\r' < xg-ph-2.tmp.po > xg-ph-2.po || exit 1
53
54 ${XGETTEXT} --omit-header --no-location -d xg-ph-2d.tmp xg-ph-2d.php || exit 1
55 LC_ALL=C tr -d '\r' < xg-ph-2d.tmp.po > xg-ph-2d.po || exit 1
56
57 ${XGETTEXT} --omit-header --no-location -d xg-ph-2s.tmp xg-ph-2s.php || exit 1
58 LC_ALL=C tr -d '\r' < xg-ph-2s.tmp.po > xg-ph-2s.po || exit 1
59
60 cat <<EOF > xg-ph-2.ok
61 msgid "Egyptians"
62 msgstr ""
63
64 msgid "Babylonians"
65 msgstr ""
66
67 msgid "Assyrians"
68 msgstr ""
69
70 msgid "Romans"
71 msgstr ""
72
73 msgid "Franks"
74 msgstr ""
75 EOF
76
77 : ${DIFF=diff}
78
79 ${DIFF} xg-ph-2.ok xg-ph-2.po
80 result=$?
81 test $result = 0 || exit $result
82
83 ${DIFF} xg-ph-2.ok xg-ph-2d.po
84 result=$?
85 test $result = 0 || exit $result
86
87 ${DIFF} xg-ph-2.ok xg-ph-2s.po
88 result=$?
89 test $result = 0 || exit $result
90
91 exit $result