From 482840e61f86ca321838a91e902c41d40c098bbb Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Wed, 24 Dec 2014 07:38:37 +0000 Subject: Imported from /home/lorry/working-area/delta_gettext-tarball/gettext-0.19.4.tar.xz. --- gettext-tools/tests/xgettext-c-20 | 128 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 gettext-tools/tests/xgettext-c-20 (limited to 'gettext-tools/tests/xgettext-c-20') diff --git a/gettext-tools/tests/xgettext-c-20 b/gettext-tools/tests/xgettext-c-20 new file mode 100755 index 0000000..73e4442 --- /dev/null +++ b/gettext-tools/tests/xgettext-c-20 @@ -0,0 +1,128 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test C support: C++11 string literals. + +: ${XGETTEXT=xgettext} + +cat <<\EOF > err0.c +gettext ("aaa( +bbb +)ccc"); +EOF + +(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err0.c 2>&1; exit) | grep 'unterminated string literal' || exit 1 + +cat <<\EOF > err1.c +gettext (R"aaa( +bbb +)ccc"); +EOF + +(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.c 2>&1; exit) | grep 'unterminated string literal' || exit 1 + +cat <<\EOF > xg-c-20.cc +#define X "" +gettext (X"This is a concatenation of a macro and a string"); + +gettext (u8"This is a UTF-8 string"); + +u88"This is not a UTF-8 string"; + +u"This is a UTF-16 string"; + +U"This is a UTF-32 string"; + +L"This is a wide string"; + +gettext (R"aaa( +This is a raw string +)aaa"); + +gettext (u8R"aaa( +This is a raw UTF-8 string +)aaa"); + +uR"aaa( +This is a UTF-16 raw string +)aaa"; + +LR"aaa( +This is a wide raw string +)aaa"; + +// Missing opening parenthesis; be tolerate and treat it as a normal string. +gettext (u8R"bar) +aaa"); + +// Missing closing parenthesis; be tolerate and treat it as a normal string. +gettext (u8R"aaa( +bar"); + +// 'LR' prefixed raw string should be skipped. +LR"( + +baz + +gettext(\"abc\"); +)"; +EOF + +${XGETTEXT} --add-comments --no-location --no-wrap \ + -o - xg-c-20.cc | grep -v 'POT-Creation-Date' > xg-c-20.tmp.po \ + || { cp core* ..; exit 1; } +LC_ALL=C tr -d '\r' < xg-c-20.tmp.po > xg-c-20.po || exit 1 + +cat <<\EOF > xg-c-20.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 , 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 \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "This is a concatenation of a macro and a string" +msgstr "" + +msgid "This is a UTF-8 string" +msgstr "" + +msgid "" +"\n" +"This is a raw string\n" +msgstr "" + +msgid "" +"\n" +"This is a raw UTF-8 string\n" +msgstr "" + +#. Missing opening parenthesis; be tolerate and treat it as a normal string. +msgid "" +"bar)\n" +"aaa" +msgstr "" + +#. Missing closing parenthesis; be tolerate and treat it as a normal string. +msgid "" +"aaa(\n" +"bar" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-c-20.ok xg-c-20.po +result=$? + +exit $result -- cgit v1.2.1