]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: C#: Add one more unit test.
authorBruno Haible <bruno@clisp.org>
Fri, 8 May 2026 00:01:55 +0000 (02:01 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 8 May 2026 00:01:55 +0000 (02:01 +0200)
* gettext-tools/tests/xgettext-csharp-10: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

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

index 77034ae8db19fa6f602fd7dbab7de2074de5f436..78f802076d59766214d6b0a293cdccdfa0c9c2cf 100644 (file)
@@ -1,5 +1,5 @@
 ## Makefile for the gettext-tools/tests subdirectory of GNU gettext
-## Copyright (C) 1995-2025 Free Software Foundation, Inc.
+## Copyright (C) 1995-2026 Free Software Foundation, Inc.
 ##
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -104,6 +104,7 @@ TESTS = gettext-1 gettext-2 \
        xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \
        xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \
        xgettext-csharp-7 xgettext-csharp-8 xgettext-csharp-9 \
+       xgettext-csharp-10 \
        xgettext-csharp-stackovfl-1 xgettext-csharp-stackovfl-2 \
        xgettext-csharp-stackovfl-3 xgettext-csharp-stackovfl-4 \
        xgettext-d-1 xgettext-d-2 xgettext-d-3 xgettext-d-4 xgettext-d-5 \
diff --git a/gettext-tools/tests/xgettext-csharp-10 b/gettext-tools/tests/xgettext-csharp-10
new file mode 100755 (executable)
index 0000000..4920206
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test C# support: --keyword option with a composed function name.
+
+cat <<\EOF > xg-cs-10.cs
+gettext ("Test 1");
+translate ("Test 2");
+foo ("Test 3");
+bar ("Test 4");
+baz ("Test 5");
+ResourceManager.gettext ("Test 11");
+ResourceManager.translate ("Test 12");
+i18n.translate ("Test 13");
+bar.baz ("Test 14");
+ResourceManager.i18n.translate ("Test 21");
+foo.bar.baz ("Test 22");
+foo . bar . baz ("Test 23");
+EOF
+
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location \
+            --keyword=gettext --keyword=i18n.translate --keyword=foo.bar.baz \
+            -d xg-cs-10.tmp xg-cs-10.cs || Exit 1
+LC_ALL=C tr -d '\r' < xg-cs-10.tmp.po > xg-cs-10.po || Exit 1
+
+cat <<\EOF > xg-cs-10.ok
+msgid "Test 1"
+msgstr ""
+
+msgid "Test 11"
+msgstr ""
+
+msgid "Test 13"
+msgstr ""
+
+msgid "Test 21"
+msgstr ""
+
+msgid "Test 22"
+msgstr ""
+
+msgid "Test 23"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-cs-10.ok xg-cs-10.po
+result=$?
+
+exit $result