From: Bruno Haible Date: Wed, 14 Jun 2023 13:06:34 +0000 (+0200) Subject: Change some tests to give more insights. X-Git-Tag: v0.22~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b29e8f6b07159b55c80badb1bf40972e14a18b06;p=thirdparty%2Fgettext.git Change some tests to give more insights. * gettext-tools/tests/format-c-3-prg.c (_): Remove macro. (main): Test also a simple translation. * gettext-tools/tests/format-c-4-prg.c: Likewise. * gettext-tools/tests/format-c-5-prg.c: Likewise. * gettext-tools/tests/format-c-3: Update. * gettext-tools/tests/format-c-4: Likewise. * gettext-tools/tests/format-c-5: Likewise. --- diff --git a/gettext-tools/tests/format-c-3 b/gettext-tools/tests/format-c-3 index 3fb9c3703..ce60c578a 100755 --- a/gettext-tools/tests/format-c-3 +++ b/gettext-tools/tests/format-c-3 @@ -8,6 +8,9 @@ ${XGETTEXT} -o fc3.tmp --omit-header --no-location "$wabs_srcdir"/format-c-3-prg LC_ALL=C tr -d '\r' < fc3.tmp > fc3.pot || Exit 1 cat < fc3.ok +msgid "the president" +msgstr "" + #, c-format msgid "father of % children" msgstr "" @@ -17,6 +20,9 @@ EOF ${DIFF} fc3.ok fc3.pot || Exit 1 cat < fc3-de.po +msgid "the president" +msgstr "der Vorsitzende" + #, c-format msgid "father of % children" msgstr "Vater von % Kindern" diff --git a/gettext-tools/tests/format-c-3-prg.c b/gettext-tools/tests/format-c-3-prg.c index 804d468d5..4725e591a 100644 --- a/gettext-tools/tests/format-c-3-prg.c +++ b/gettext-tools/tests/format-c-3-prg.c @@ -1,5 +1,5 @@ /* Test program, used by the format-c-3 test. - Copyright (C) 2002, 2009, 2013, 2018, 2020 Free Software Foundation, Inc. + Copyright (C) 2002, 2009, 2013, 2018, 2020, 2023 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 @@ -45,8 +45,6 @@ extern char *setlocale (int category, const char *locale); #endif -#define _(string) gettext (string) - /* Fallback definition. */ #if !defined PRId8 # define PRId8 "d" @@ -71,6 +69,12 @@ main (int argc, char *argv[]) textdomain ("fc3"); bindtextdomain ("fc3", "fc3-dir"); + if (strcmp (gettext ("the president"), "der Vorsitzende") != 0) + { + fprintf (stderr, "Simple messages not translated.\n"); + exit (1); + } + s = gettext ("father of %"PRId8" children"); c1 = "Vater von %"; c2 = " Kindern"; diff --git a/gettext-tools/tests/format-c-4 b/gettext-tools/tests/format-c-4 index accd1173c..37f871fa5 100755 --- a/gettext-tools/tests/format-c-4 +++ b/gettext-tools/tests/format-c-4 @@ -8,6 +8,9 @@ ${XGETTEXT} -o fc4.tmp --omit-header --no-location "$wabs_srcdir"/format-c-4-prg LC_ALL=C tr -d '\r' < fc4.tmp > fc4.pot || Exit 1 cat < fc4.ok +msgid "the president" +msgstr "" + #, c-format msgid "father of % child" msgid_plural "father of % children" @@ -19,6 +22,9 @@ EOF ${DIFF} fc4.ok fc4.pot || Exit 1 cat < fc4-de.po +msgid "the president" +msgstr "der Vorsitzende" + #, c-format msgid "father of % child" msgid_plural "father of % children" diff --git a/gettext-tools/tests/format-c-4-prg.c b/gettext-tools/tests/format-c-4-prg.c index 4dac6af79..754b66ce8 100644 --- a/gettext-tools/tests/format-c-4-prg.c +++ b/gettext-tools/tests/format-c-4-prg.c @@ -1,5 +1,5 @@ /* Test program, used by the format-c-4 test. - Copyright (C) 2002, 2009, 2013, 2018, 2020 Free Software Foundation, Inc. + Copyright (C) 2002, 2009, 2013, 2018, 2020, 2023 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 @@ -45,8 +45,6 @@ extern char *setlocale (int category, const char *locale); #endif -#define _(string) gettext (string) - /* Fallback definition. */ #if !defined PRId8 # define PRId8 "d" @@ -71,6 +69,12 @@ main (int argc, char *argv[]) textdomain ("fc4"); bindtextdomain ("fc4", "fc4-dir"); + if (strcmp (gettext ("the president"), "der Vorsitzende") != 0) + { + fprintf (stderr, "Simple messages not translated.\n"); + exit (1); + } + s = ngettext ("father of %"PRId8" child", "father of %"PRId8" children", n); c1 = "Vater von %"; c2 = " Kindern"; diff --git a/gettext-tools/tests/format-c-5 b/gettext-tools/tests/format-c-5 index b8111eed3..d0cba225c 100755 --- a/gettext-tools/tests/format-c-5 +++ b/gettext-tools/tests/format-c-5 @@ -8,6 +8,9 @@ ${XGETTEXT} -o fc5.tmp --omit-header --no-location "$wabs_srcdir"/format-c-5-prg LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || Exit 1 cat < fc5.ok +msgid "the president" +msgstr "" + #, c-format msgid "father of %d children" msgstr "" @@ -18,6 +21,9 @@ ${DIFF} fc5.ok fc5.pot || Exit 1 # This should better be Farsi, not German. Can some translator help me? cat < fa.po +msgid "the president" +msgstr "der Vorsitzende" + #, c-format msgid "father of %d children" msgstr "Vater von %Id Kindern" diff --git a/gettext-tools/tests/format-c-5-prg.c b/gettext-tools/tests/format-c-5-prg.c index 9efffacd1..eacbbf91a 100644 --- a/gettext-tools/tests/format-c-5-prg.c +++ b/gettext-tools/tests/format-c-5-prg.c @@ -1,5 +1,5 @@ /* Test program, used by the format-c-5 test. - Copyright (C) 2004, 2006, 2010, 2018 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2010, 2018, 2023 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 @@ -38,8 +38,6 @@ # include "libgnuintl.h" #endif -#define _(string) gettext (string) - int main (int argc, char *argv[]) { @@ -58,6 +56,12 @@ main (int argc, char *argv[]) textdomain ("fc5"); bindtextdomain ("fc5", "."); + if (strcmp (gettext ("the president"), "der Vorsitzende") != 0) + { + fprintf (stderr, "Simple messages not translated.\n"); + exit (1); + } + s = gettext ("father of %d children"); en = "father of %d children"; #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__ @@ -70,7 +74,7 @@ main (int argc, char *argv[]) if (strcmp (s, en) == 0) { - fprintf (stderr, "String untranslated.\n"); + fprintf (stderr, "String not translated.\n"); exit (1); } if (strcmp (s, expected_translation) != 0)