]> Savannah Git Hosting - gnulib.git/commitdiff
setlocale_null-unlocked: Add tests.
authorBruno Haible <bruno@clisp.org>
Thu, 15 Feb 2024 09:32:57 +0000 (10:32 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 15 Feb 2024 21:30:46 +0000 (22:30 +0100)
* tests/test-setlocale_null-unlocked.c: New file, based on
tests/test-setlocale_null.c.
* modules/setlocale-null-unlocked-tests: New file.

ChangeLog
modules/setlocale-null-unlocked-tests [new file with mode: 0644]
tests/test-setlocale_null-unlocked.c [new file with mode: 0644]

index b2668b99bf62f5f177e5ac50a7972ef3e2cab45d..761f51bc36228bbbd58eeb3e2f4cf1c364c7eaca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-02-15  Bruno Haible  <bruno@clisp.org>
 
+       setlocale_null-unlocked: Add tests.
+       * tests/test-setlocale_null-unlocked.c: New file, based on
+       tests/test-setlocale_null.c.
+       * modules/setlocale-null-unlocked-tests: New file.
+
        setlocale_null-unlocked: New module.
        * lib/setlocale_null.h (setlocale_null_r_unlocked,
        setlocale_null_unlocked): New declarations.
diff --git a/modules/setlocale-null-unlocked-tests b/modules/setlocale-null-unlocked-tests
new file mode 100644 (file)
index 0000000..1fbfb89
--- /dev/null
@@ -0,0 +1,10 @@
+Files:
+tests/test-setlocale_null-unlocked.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-setlocale_null-unlocked
+check_PROGRAMS += test-setlocale_null-unlocked
diff --git a/tests/test-setlocale_null-unlocked.c b/tests/test-setlocale_null-unlocked.c
new file mode 100644 (file)
index 0000000..d06dec6
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test of setlocale_null_r_unlocked function.
+   Copyright (C) 2019-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>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "setlocale_null.h"
+
+#include <locale.h>
+
+/* Check that SETLOCALE_NULL_ALL_MAX is a constant expression.  */
+static char buf[SETLOCALE_NULL_ALL_MAX];
+
+int
+main ()
+{
+  /* Check that setlocale_null_r_unlocked() can be used without any
+     libraries.  */
+  return setlocale_null_r_unlocked (LC_ALL, buf, sizeof (buf)) != 0;
+}