On native Windows, the nstrftime and c-nstrftime tests fail in particular
because of this output:

PST8PDT,M3.2.0,M11.1.0: expected "1969-12-31 16:00:00 -0800 (PST)", got 
"1969-12-31 16:00:00  (PST)"
MST7: expected "1969-12-31 17:00:00 -0700 (MST)", got "1969-12-31 17:00:00  
(MST)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "1970-01-01 01:00:00 +0100 (CET)", got 
"1970-01-01 01:00:00 +0100 (W. Europe Standard Time)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "1985-11-05 01:53:21 +0100 (CET)", got 
"1985-11-05 01:53:21 +0100 (W. Europe Standard Time)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "2001-09-09 03:46:42 +0200 (CEST)", got 
"2001-09-09 03:46:42 +0200 (W. Europe Daylight Time)"

I think one needs to accept the fact that time zones have different names
in Windows than in POSIX. This patch thus makes the test ignore differences
in the right-hand part of the results.


2024-05-27  Bruno Haible  <br...@clisp.org>

        nstrftime, c-nstrftime tests: Avoid some failures on native Windows.
        * tests/test-nstrftime.h (tzalloc_test): On native Windows, ignore
        differences in the way the time zone is printed.

diff --git a/tests/test-nstrftime.h b/tests/test-nstrftime.h
index 18828ae91d..6a6b10daea 100644
--- a/tests/test-nstrftime.h
+++ b/tests/test-nstrftime.h
@@ -219,7 +219,12 @@ tzalloc_test (void)
       if (! (STREQ (buf, LT[i].exp)
              || (!tz && n == strlen (LT[i].exp)
                  && memcmp (buf, LT[i].exp, n - sizeof "(GMT)" + 1) == 0
-                 && STREQ (buf + n - sizeof "(GMT)" + 1, "(GMT)"))))
+                 && STREQ (buf + n - sizeof "(GMT)" + 1, "(GMT)"))
+#if defined _WIN32 && !defined __CYGWIN__
+             /* On native Windows, the time zone is printed differently.  */
+             || strncmp (buf, LT[i].exp, 21) == 0
+#endif
+         )  )
         {
           /* Don't fail for unhandled dst in ahistorical entries,
              as gnulib doesn't currently fix that issue, seen on Darwin 14.  */




Reply via email to