Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-vala-1
1 #!/bin/sh
2
3 # Test of Vala support.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-vala-1.vala"
9 cat <<\EOF > xg-vala-1.vala
10 int main (string[] args) {
11     var s1 = "Simple string, no gettext needed";
12     var s2 = _("Extract this first string");
13     var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix";
14
15     if (args[0] == _("Extract this thirth string")) {
16       /* _("This is a comment and must not be extracted!") */
17     }
18
19     var s4 = _("""Extract this
20     ""
21     fourth string""");
22     return 0;
23 }
24 EOF
25
26 tmpfiles="$tmpfiles xg-vala-1.err xg-vala-1.tmp xg-vala-1.pot"
27 : ${XGETTEXT=xgettext}
28 ${XGETTEXT} --add-comments --no-location -o xg-vala-1.tmp xg-vala-1.vala 2>xg-vala-1.err
29 test $? = 0 || { cat xg-vala-1.err; rm -fr $tmpfiles; exit 1; }
30 # Don't simplify this to "grep ... < xg-vala-1.tmp", otherwise OpenBSD 4.0 grep
31 # only outputs "Binary file (standard input) matches".
32 cat xg-vala-1.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-vala-1.pot
33
34 tmpfiles="$tmpfiles xg-vala-1.ok"
35 cat <<\EOF > xg-vala-1.ok
36 # SOME DESCRIPTIVE TITLE.
37 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
38 # This file is distributed under the same license as the PACKAGE package.
39 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
40 #
41 #, fuzzy
42 msgid ""
43 msgstr ""
44 "Project-Id-Version: PACKAGE VERSION\n"
45 "Report-Msgid-Bugs-To: \n"
46 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
47 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
48 "Language-Team: LANGUAGE <LL@li.org>\n"
49 "Language: \n"
50 "MIME-Version: 1.0\n"
51 "Content-Type: text/plain; charset=CHARSET\n"
52 "Content-Transfer-Encoding: 8bit\n"
53
54 msgid "Extract this first string"
55 msgstr ""
56
57 msgid "Extract this second string"
58 msgstr ""
59
60 msgid "Extract this thirth string"
61 msgstr ""
62
63 msgid ""
64 "Extract this\n"
65 "    \"\"\n"
66 "    fourth string"
67 msgstr ""
68 EOF
69
70 : ${DIFF=diff}
71 ${DIFF} xg-vala-1.ok xg-vala-1.pot
72 result=$?
73
74 rm -fr $tmpfiles
75
76 exit $result