From: Bruno Haible Date: Fri, 8 May 2026 00:01:55 +0000 (+0200) Subject: xgettext: C#: Add one more unit test. X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=563d672951bbe2f235de93da1b4e2446369544ac;p=thirdparty%2Fgettext.git xgettext: C#: Add one more unit test. * gettext-tools/tests/xgettext-csharp-10: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it. --- diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 77034ae8d..78f802076 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -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 index 000000000..49202064f --- /dev/null +++ b/gettext-tools/tests/xgettext-csharp-10 @@ -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