summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-10-09 13:53:57 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:15:16 +0200
commit86cb64d10f76e43040a37361b4a5731ae579cf7f (patch)
treeb9d461c7c17e6a4929fad399df34a5d5d6ac31cd
parent7ffc2051def99e20ffb3777ed8843b973f5d4720 (diff)
downloadexternal_gettext-86cb64d10f76e43040a37361b4a5731ae579cf7f.zip
external_gettext-86cb64d10f76e43040a37361b4a5731ae579cf7f.tar.gz
external_gettext-86cb64d10f76e43040a37361b4a5731ae579cf7f.tar.bz2
Test kde-format and format recognition heuristics.
-rw-r--r--gettext-tools/tests/ChangeLog5
-rw-r--r--gettext-tools/tests/Makefile.am2
-rwxr-xr-xgettext-tools/tests/xgettext-c-1745
3 files changed, 51 insertions, 1 deletions
diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog
index 3fcc4e4..4aaee9e 100644
--- a/gettext-tools/tests/ChangeLog
+++ b/gettext-tools/tests/ChangeLog
@@ -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+.
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index 34069ab..4057093 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -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
index 0000000..011c778
--- /dev/null
+++ b/gettext-tools/tests/xgettext-c-17
@@ -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