Hi Ben,

> Consider adding the following modules/gettext-tests:

Thanks for the suggestion. Done through the attached patch.

>From 2f2a5bb27baa5623f3229a6215c4b96a573fb9ed Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 24 Nov 2024 19:06:32 +0100
Subject: [PATCH] gettext-h: Add tests.

Suggested by Ben Pfaff <b...@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               |  6 ++++++
 modules/gettext-h-tests | 11 +++++++++++
 tests/test-gettext-h.c  | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 modules/gettext-h-tests
 create mode 100644 tests/test-gettext-h.c

diff --git a/ChangeLog b/ChangeLog
index 2ff1801b11..e2ff16080a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-11-24  Bruno Haible  <br...@clisp.org>
 
+	gettext-h: Add tests.
+	Suggested by Ben Pfaff <b...@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.beckm...@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
index 0000000000..878ca8c2c7
--- /dev/null
+++ b/modules/gettext-h-tests
@@ -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
index 0000000000..6a3f9d0a61
--- /dev/null
+++ b/tests/test-gettext-h.c
@@ -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 <br...@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;
+}
-- 
2.34.1

Reply via email to