summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-vala-1
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-vala-1
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-vala-1')
-rwxr-xr-xgettext-tools/tests/xgettext-vala-128
1 files changed, 26 insertions, 2 deletions
diff --git a/gettext-tools/tests/xgettext-vala-1 b/gettext-tools/tests/xgettext-vala-1
index 7eda7be..9d87381 100755
--- a/gettext-tools/tests/xgettext-vala-1
+++ b/gettext-tools/tests/xgettext-vala-1
@@ -3,6 +3,15 @@
# Test of Vala support.
+: ${XGETTEXT=xgettext}
+
+cat <<\EOF > xg-vala-1.err.vala
+int main (string[] args) {
+ var r1 = /a
+EOF
+
+(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location -o - xg-vala-1.err.vala 2>&1; exit) | grep 'regular expression literal terminated too early' || exit 1
+
cat <<\EOF > xg-vala-1.vala
int main (string[] args) {
var s1 = "Simple string, " + " no gettext needed";
@@ -23,14 +32,25 @@ int main (string[] args) {
var s5 = _("Extract this \u2464th string");
- var s6 = /_("This is a regex literal and must not be extracted!")/i;
+ var s6 = /_("This is a regex literal and must not be extracted!")\|/i;
+ var d1 = 10e-1;
+ var d2 = 10E-1;
+
+ /* This is a
+ multiline C style comment */
var s7 = _("Extract this //sixth string");
+
+ var s8 = _(@"This is a template string, which cannot be extracted!");
+
+ /* /= shouldn't start a regex literal */
+ var i1 = 1000;
+ i1 /= 10;
+
return 0;
}
EOF
-: ${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; exit 1; }
# Don't simplify this to "grep ... < xg-vala-1.tmp", otherwise OpenBSD 4.0 grep
@@ -75,6 +95,8 @@ msgstr ""
msgid "Extract this ⑤th string"
msgstr ""
+#. This is a
+#. multiline C style comment
msgid "Extract this //sixth string"
msgstr ""
EOF
@@ -138,6 +160,8 @@ msgstr ""
msgid "Extract this ⑤th string"
msgstr ""
+#. This is a
+#. multiline C style comment
msgid "Extract this //sixth string"
msgstr ""
EOF