From: Paul Eggert Date: Sun, 2 Feb 2025 23:27:39 +0000 (-0800) Subject: test-gettext-h: check call results X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b838e1a5d0b36aa451011c2de9fa710f1165cf87;p=gnulib.git test-gettext-h: check call results * tests/test-gettext-h.c: Include string.h. (main): Check return values of calls. This also pacifies GCC, which otherwise might warn about a variable being set but not used. --- diff --git a/ChangeLog b/ChangeLog index cc0fe24943..2b02191a57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-02-02 Paul Eggert + + test-gettext-h: check call results + * tests/test-gettext-h.c: Include string.h. + (main): Check return values of calls. + This also pacifies GCC, which otherwise might + warn about a variable being set but not used. + 2025-01-31 Paul Eggert announce-gen: add comments diff --git a/tests/test-gettext-h.c b/tests/test-gettext-h.c index 6eb9affb9a..04e6c6df71 100644 --- a/tests/test-gettext-h.c +++ b/tests/test-gettext-h.c @@ -20,6 +20,8 @@ #include "gettext.h" +#include + int main (void) { @@ -28,7 +30,12 @@ main (void) textdomain ("tzlof"); s = gettext ("some text"); + if (strcmp (s, "some text") != 0) + return 1; + s = pgettext ("menu", "some other text"); + if (strcmp (s, "some other text") != 0) + return 1; return 0; }