From af029caa3537b78d2e62e2674cfc82381bb29e66 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 15 Feb 2024 10:32:57 +0100 Subject: [PATCH] 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. --- ChangeLog | 5 ++++ modules/setlocale-null-unlocked-tests | 10 ++++++++ tests/test-setlocale_null-unlocked.c | 35 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 modules/setlocale-null-unlocked-tests create mode 100644 tests/test-setlocale_null-unlocked.c diff --git a/ChangeLog b/ChangeLog index b2668b99bf..761f51bc36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2024-02-15 Bruno Haible + 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 index 0000000000..1fbfb895a0 --- /dev/null +++ b/modules/setlocale-null-unlocked-tests @@ -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 index 0000000000..d06dec6071 --- /dev/null +++ b/tests/test-setlocale_null-unlocked.c @@ -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 . */ + +/* Written by Bruno Haible , 2019. */ + +#include + +/* Specification. */ +#include "setlocale_null.h" + +#include + +/* 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; +} -- 2.39.5