]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: New test of concatenation of strings with escape sequences.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 18:41:53 +0000 (19:41 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 18:41:53 +0000 (19:41 +0100)
Reported by Morten Welinder <mwelinder@gmail.com>
in <https://lists.gnu.org/archive/html/bug-gettext/2015-12/msg00017.html>
and <https://savannah.gnu.org/bugs/?46756>.

* gettext-tools/tests/xgettext-c-23: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-c-23 [new file with mode: 0755]

index e8a4a8207eab3ca56e07b69ae80a55bbc9ef8173..afc3e3b0afe38a3eb9a3aca569cab9cda3bc69a2 100644 (file)
@@ -82,7 +82,7 @@ TESTS = gettext-1 gettext-2 \
        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-17 xgettext-c-18 xgettext-c-19 xgettext-c-20 \
-       xgettext-c-21 xgettext-c-22 \
+       xgettext-c-21 xgettext-c-22 xgettext-c-23 \
        xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \
        xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \
        xgettext-csharp-7 xgettext-csharp-8 \
diff --git a/gettext-tools/tests/xgettext-c-23 b/gettext-tools/tests/xgettext-c-23
new file mode 100755 (executable)
index 0000000..67166de
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test C support: Concatenation of strings with escape sequences.
+
+: ${XGETTEXT=xgettext}
+
+cat <<\EOF > xg-c-23.c
+char *x = N_("Jean Br\xc3\xa9""fort");
+EOF
+
+${XGETTEXT} --from-code=UTF-8 --no-location -kN_ \
+            -o xg-c-23.tmp xg-c-23.c || Exit 1
+grep -v 'POT-Creation-Date' < xg-c-23.tmp > xg-c-23.tmq || Exit 1
+LC_ALL=C tr -d '\r' < xg-c-23.tmq > xg-c-23.po || Exit 1
+
+cat <<\EOF > xg-c-23.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "Jean Bréfort"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-c-23.ok xg-c-23.po
+result=$?
+
+exit $result