]> Savannah Git Hosting - gnulib.git/commitdiff
gettext-h: Add tests.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Nov 2024 18:06:32 +0000 (19:06 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Nov 2024 18:06:32 +0000 (19:06 +0100)
Suggested by Ben Pfaff <blp@cs.stanford.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00186.html>.

* tests/test-gettext-h.c: New file.
* modules/gettext-h-tests: New file.

ChangeLog
modules/gettext-h-tests [new file with mode: 0644]
tests/test-gettext-h.c [new file with mode: 0644]

index 2ff1801b11867c148a8202e34d71b30565d0f230..e2ff16080a57a35cae60172b4d85adf1be0085f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-11-24  Bruno Haible  <bruno@clisp.org>
 
+       gettext-h: Add tests.
+       Suggested by Ben Pfaff <blp@cs.stanford.edu> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00186.html>.
+       * tests/test-gettext-h.c: New file.
+       * modules/gettext-h-tests: New file.
+
        gettext-h: Fix compilation error when pgettext is used.
        Reported by Friedrich Beckmann <friedrich.beckmann@posteo.de> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00189.html>.
diff --git a/modules/gettext-h-tests b/modules/gettext-h-tests
new file mode 100644 (file)
index 0000000..878ca8c
--- /dev/null
@@ -0,0 +1,11 @@
+Files:
+tests/test-gettext-h.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-gettext-h
+check_PROGRAMS += test-gettext-h
+test_gettext_h_LDADD = $(LDADD) $(LIBINTL)
diff --git a/tests/test-gettext-h.c b/tests/test-gettext-h.c
new file mode 100644 (file)
index 0000000..6a3f9d0
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of gettext.h convenience header.
+   Copyright (C) 2024 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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2024.  */
+
+#include <config.h>
+
+#include "gettext.h"
+
+int
+main (void)
+{
+  const char *s;
+
+  textdomain ("tzlof");
+
+  s = gettext ("some text");
+  s = pgettext ("menu", "some other text");
+
+  return 0;
+}