]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test kde-format and format recognition heuristics.
authorBruno Haible <bruno@clisp.org>
Tue, 9 Oct 2007 13:53:57 +0000 (13:53 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:16 +0000 (12:15 +0200)
gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-c-17 [new file with mode: 0755]

index 3fcc4e47db96150661c15efb9a340025962fa282..4aaee9e8d5f9f6379a1156fd28ff43aeae1c9803 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-09  Bruno Haible  <bruno@clisp.org>
+
+       * xgettext-c-17: New file.
+       * Makefile.am (TESTS): Add it.
+
 2007-10-07  Bruno Haible  <bruno@clisp.org>
 
        * tstgettext.c (main): In the --version output, say GPLv3+.
index 34069abbd8b4f9518a94613f0df263dd0739d1a9..405709389e91175b82baddcdb48683ff3cac3c25 100644 (file)
@@ -71,7 +71,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
        xgettext-c-1 xgettext-c-2 xgettext-c-3 xgettext-c-4 xgettext-c-5 \
        xgettext-c-6 xgettext-c-7 xgettext-c-8 xgettext-c-9 xgettext-c-10 \
        xgettext-c-11 xgettext-c-12 xgettext-c-13 xgettext-c-14 xgettext-c-15 \
-       xgettext-c-16 \
+       xgettext-c-16 xgettext-c-17 \
        xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \
        xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \
        xgettext-csharp-7 \
diff --git a/gettext-tools/tests/xgettext-c-17 b/gettext-tools/tests/xgettext-c-17
new file mode 100755 (executable)
index 0000000..011c778
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+
+# Test C++ support: test kde-format and format recognition heuristics.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-c-17.cc"
+cat <<\EOF > xg-c-17.cc
+/* When xgettext has no info, it flags both c-format and kde-format, based
+   on the heuristics.  */
+gettext ("used time: %1m %2s");
+
+/* When the programmer says it's kde-format, xgettext does not apply the
+   heuristics.  */
+/* xgettext: kde-format */
+gettext ("remaining time: %1m %2s");
+EOF
+
+tmpfiles="$tmpfiles xg-c-17.tmp.po xg-c-17.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location -d xg-c-17.tmp --language=C++ --kde \
+  xg-c-17.cc
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+tr -d '\r' < xg-c-17.tmp.po > xg-c-17.po
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-c-17.ok"
+cat <<EOF > xg-c-17.ok
+#, c-format, kde-format
+msgid "used time: %1m %2s"
+msgstr ""
+
+#, kde-format
+msgid "remaining time: %1m %2s"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-c-17.ok xg-c-17.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result