]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tests: Add test for Unicode surrogate characters in C#
authorDaiki Ueno <ueno@gnu.org>
Mon, 1 Dec 2014 04:41:28 +0000 (13:41 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 1 Dec 2014 05:55:19 +0000 (14:55 +0900)
* xgettext-csharp-8: New file.
* Makefile.am (TESTS): Add new test.

gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-csharp-8 [new file with mode: 0755]

index 0daf510556e99b9084e2402245c70f2d33666a5e..746e6ac6a3f28bf0f878e54236b32fadd394cd40 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-01  Daiki Ueno  <ueno@gnu.org>
+
+       tests: Add test for Unicode surrogate characters in C#
+       * xgettext-csharp-8: New file.
+       * Makefile.am (TESTS): Add new test.
+
 2014-11-28  Daiki Ueno  <ueno@gnu.org>
 
        tests: Add test for empty msgstr passed to msgfilter
index d4d567ef2506b7312b047af4c96679b7cd7b9e90..f5766cc678a07dcc4e8c6fb0c3378e8efd3e41c4 100644 (file)
@@ -79,7 +79,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
        xgettext-c-16 xgettext-c-17 xgettext-c-18 xgettext-c-19 \
        xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \
        xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \
-       xgettext-csharp-7 \
+       xgettext-csharp-7 xgettext-csharp-8 \
        xgettext-elisp-1 xgettext-elisp-2 \
        xgettext-glade-1 xgettext-glade-2 xgettext-glade-3 xgettext-glade-4 \
        xgettext-glade-5 xgettext-glade-6 xgettext-glade-7 \
diff --git a/gettext-tools/tests/xgettext-csharp-8 b/gettext-tools/tests/xgettext-csharp-8
new file mode 100755 (executable)
index 0000000..f5e5694
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test C# support: Unicode character escape handling
+
+cat <<\EOF > xg-cs-8.cs
+// Valid:
+string s1 = "\U00020213";    // Codepoint U+20213
+string s2 = "\uD840\uDE13";  // Encoded form of U+20213
+string s3 = "\uD840\U0000DE13";  // Encoded form of U+20213
+string s4 = "\U0000D840\uDE13";  // Encoded form of U+20213
+string s5 = "\U0000D840\U0000DE13";  // Encoded form of U+20213
+string s6 = "\xD840\xDE13";  // Encoded form of U+20213
+
+// Invalid:
+string i1 = "\U0020213";    // Unterminated
+string i2 = "\uD840\u3032";  // Missing low surrogate
+string i3 = "\uD840\uDE1";    // Unterminated after a high surrogate
+EOF
+
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --output - --add-location xg-cs-8.cs -a 2>/dev/null | \
+  sed '/\"POT-Creation-Date:.*/d' | LC_ALL=C tr -d '\r' > xg-cs-8.po || \
+  exit 1
+
+cat <<\EOF > xg-cs-8.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"
+
+#: xg-cs-8.cs:2 xg-cs-8.cs:3 xg-cs-8.cs:4 xg-cs-8.cs:5 xg-cs-8.cs:6
+#: xg-cs-8.cs:7
+msgid "𠈓"
+msgstr ""
+
+#: xg-cs-8.cs:10
+msgid "\\U0020213"
+msgstr ""
+
+#: xg-cs-8.cs:11
+msgid "�〲"
+msgstr ""
+
+#: xg-cs-8.cs:12
+msgid "�\\uDE1"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-cs-8.ok xg-cs-8.po
+result=$?
+
+exit $result