]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test that the heuristics don't mark as c-format strings that are unlikely
authorBruno Haible <bruno@clisp.org>
Mon, 13 Feb 2006 13:06:20 +0000 (13:06 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:59 +0000 (12:12 +0200)
c-format strings.

gettext-tools/tests/xgettext-c-12 [new file with mode: 0755]

diff --git a/gettext-tools/tests/xgettext-c-12 b/gettext-tools/tests/xgettext-c-12
new file mode 100755 (executable)
index 0000000..e8bb389
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+# Test C support: valid but unlikely C format strings are _not_ marked as
+# c-format by default.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-c-12.c"
+cat <<\EOF > xg-c-12.c
+gettext ("%1% on, %2% off");
+EOF
+
+tmpfiles="$tmpfiles xg-c-12.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location -d xg-c-12 xg-c-12.c
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-c-12.ok"
+cat <<EOF > xg-c-12.ok
+msgid "%1% on, %2% off"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-c-12.ok xg-c-12.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result