commit 00fb4107cb2485121255a64a90e22bc969dad116
parent 0e5d6d353ab4998e720ee76eb7c37cc10c941cf5
Author: Chris Bracken <chris@bracken.jp>
Date: Thu, 24 Jul 2025 13:43:33 -0700
Add test for print_time_z
Adds a unit test for UTC output.
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/format_tests.c b/format_tests.c
@@ -59,3 +59,20 @@ UTEST(print_time, ZeroOffset) {
free(buf);
}
+
+UTEST(print_time_z, Basic) {
+ char* buf = NULL;
+ size_t size = 0;
+ FILE* out = open_memstream(&buf, &size);
+ ASSERT_NE(NULL, out);
+
+ /* Test time: 2023-12-08 10:30:00 UTC */
+ time_t test_time = 1702031400;
+
+ print_time_z(out, test_time);
+ fclose(out);
+
+ EXPECT_STREQ("2023-12-08T10:30:00Z", buf);
+
+ free(buf);
+}