From 122c9f63a9fd8f2308041cf4167d61bd57421e06 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 6 Jun 2024 18:05:57 +0200 Subject: [PATCH] tzname: Add tests. * tests/test-tzname.c: New file. * modules/tzname-tests: New file. --- ChangeLog | 4 ++++ modules/tzname-tests | 11 +++++++++++ tests/test-tzname.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 modules/tzname-tests create mode 100644 tests/test-tzname.c diff --git a/ChangeLog b/ChangeLog index f46735ac57..06cfb23a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-06-06 Bruno Haible + tzname: Add tests. + * tests/test-tzname.c: New file. + * modules/tzname-tests: New file. + tzname: New module. * lib/time.in.h (tzname): New declaration. * m4/tzname.m4: New file. diff --git a/modules/tzname-tests b/modules/tzname-tests new file mode 100644 index 0000000000..b2c590eaff --- /dev/null +++ b/modules/tzname-tests @@ -0,0 +1,11 @@ +Files: +tests/test-tzname.c + +Depends-on: +tzset + +configure.ac: + +Makefile.am: +TESTS += test-tzname +check_PROGRAMS += test-tzname diff --git a/tests/test-tzname.c b/tests/test-tzname.c new file mode 100644 index 0000000000..385d594cc3 --- /dev/null +++ b/tests/test-tzname.c @@ -0,0 +1,36 @@ +/* Test of tzname array. + 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 . */ + +/* Written by Bruno Haible , 2024. */ + +#include + +/* Specification. */ +#include + +#include +#include + +int +main () +{ + const char *tz = getenv ("TZ"); + tzset (); + printf ("TZ=%s -> tzname[0]=\"%s\", tzname[1]=\"%s\"\n", + tz != NULL ? tz : "(null)", + tzname[0], tzname[1]); + return 0; +} -- 2.39.5