summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-c-19
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-10-08 12:00:51 +0900
committerDaiki Ueno <ueno@gnu.org>2014-10-08 12:00:51 +0900
commitfa8e859254eac21d8742b47a55b31f67c267a6c8 (patch)
tree06396a45bff029e9792762620c16f5f5c1c23ed0 /gettext-tools/tests/xgettext-c-19
parenta9be7bd5e317cb726fb93ca7e145c56c4f05dcfd (diff)
downloadexternal_gettext-fa8e859254eac21d8742b47a55b31f67c267a6c8.zip
external_gettext-fa8e859254eac21d8742b47a55b31f67c267a6c8.tar.gz
external_gettext-fa8e859254eac21d8742b47a55b31f67c267a6c8.tar.bz2
tests: Improve test coverage of C and Vala scanners
* xgettext-c-4: Check more trigraphs. * xgettext-c-2: Check floating point literal. * xgettext-c-19: Check out-of-range Unicode character, "\U" character escape, incomplete "\u" escape, and surrogates. * xgettext-vala-1: Check unterminated regexp literal, floating point literal, string template, "/=" operator, multi-line comments, and backslash-escaped character inside regexp literal.
Diffstat (limited to 'gettext-tools/tests/xgettext-c-19')
-rwxr-xr-xgettext-tools/tests/xgettext-c-1931
1 files changed, 25 insertions, 6 deletions
diff --git a/gettext-tools/tests/xgettext-c-19 b/gettext-tools/tests/xgettext-c-19
index 06de17d..09a227a 100755
--- a/gettext-tools/tests/xgettext-c-19
+++ b/gettext-tools/tests/xgettext-c-19
@@ -4,6 +4,15 @@
# Test C support: mixing ANSI escapes, Unicode escapes, and bare
# multibyte characters.
+: ${XGETTEXT=xgettext}
+
+cat <<\EOF > err1.c
+/* Out of range */
+gettext ("\U00110000");
+EOF
+
+(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.c 2>&1; exit) | grep 'invalid Unicode character' || exit 1
+
cat <<\EOF > xg-c-19.in.c
/* 最初のコメント */
"最初の文字列";
@@ -12,20 +21,22 @@ cat <<\EOF > xg-c-19.in.c
gettext ("二番目の文字列");
/* 三番目のコメント */
-pgettext ("\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCE\363");
+pgettext ("\u30B3\u30F3\u30C6\u30af\u30B9\u30C8\U0001F600\ud835\udc9ea", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCe\363");
+
+gettext ("\"\'\?\\\a\b\f\n\r\t\v\xG\0000");
+gettext ("\u30A");
EOF
: ${ICONV=iconv}
iconv -f UTF-8 -t EUC-JP < xg-c-19.in.c > xg-c-19.c \
|| { echo "Skipping test: iconv does not work for EUC-JP"; exit 77; }
-: ${XGETTEXT=xgettext}
-${XGETTEXT} --from-code=EUC-JP --add-comments --no-location \
+${XGETTEXT} --from-code=EUC-JP --add-comments --no-location --no-wrap \
-o - xg-c-19.c | grep -v 'POT-Creation-Date' > xg-c-19.tmp.po \
- || exit 1
+ || { cp core* ..; exit 1; }
LC_ALL=C tr -d '\r' < xg-c-19.tmp.po > xg-c-19.po || exit 1
-cat <<EOF > xg-c-19.ok
+cat <<\EOF > xg-c-19.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
@@ -49,9 +60,17 @@ msgid "二番目の文字列"
msgstr ""
#. 三番目のコメント
-msgctxt "コンテクスト"
+msgctxt "コンテクスト😀𝒞a"
msgid "三番目の文字列"
msgstr ""
+
+msgid ""
+"\"'?\\\a\b\f\n"
+"\r\t\v\\xG"
+msgstr ""
+
+msgid "\\u30A"
+msgstr ""
EOF
: ${DIFF=diff}