diff options
Diffstat (limited to 'gettext-tools/tests/xgettext-vala-1')
-rw-r--r-- | gettext-tools/tests/xgettext-vala-1 | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gettext-tools/tests/xgettext-vala-1 b/gettext-tools/tests/xgettext-vala-1 new file mode 100644 index 0000000..7c7e243 --- /dev/null +++ b/gettext-tools/tests/xgettext-vala-1 @@ -0,0 +1,76 @@ +#!/bin/sh + +# Test of Vala support. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-vala-1.vala" +cat <<\EOF > xg-vala-1.vala +int main (string[] args) { + var s1 = "Simple string, no gettext needed"; + var s2 = _("Extract this first string"); + var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix"; + + if (args[0] == _("Extract this thirth string")) { + /* _("This is a comment and must not be extracted!") */ + } + + var s4 = _("""Extract this + "" + fourth string"""); + return 0; +} +EOF + +tmpfiles="$tmpfiles xg-vala-1.err xg-vala-1.tmp xg-vala-1.pot" +: ${XGETTEXT=xgettext} +${XGETTEXT} --add-comments --no-location -o xg-vala-1.tmp xg-vala-1.vala 2>xg-vala-1.err +test $? = 0 || { cat xg-vala-1.err; rm -fr $tmpfiles; exit 1; } +# Don't simplify this to "grep ... < xg-vala-1.tmp", otherwise OpenBSD 4.0 grep +# only outputs "Binary file (standard input) matches". +cat xg-vala-1.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-vala-1.pot + +tmpfiles="$tmpfiles xg-vala-1.ok" +cat <<\EOF > xg-vala-1.ok +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Extract this first string" +msgstr "" + +msgid "Extract this second string" +msgstr "" + +msgid "Extract this thirth string" +msgstr "" + +msgid "" +"Extract this\n" +" \"\"\n" +" fourth string" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-vala-1.ok xg-vala-1.pot +result=$? + +rm -fr $tmpfiles + +exit $result |