commit ffae3154d0d0ea6b550ac7a07d4ba90f2acb9d11
parent 00fb4107cb2485121255a64a90e22bc969dad116
Author: Chris Bracken <chris@bracken.jp>
Date: Thu, 24 Jul 2025 13:45:19 -0700
Add test for print_time_short
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/format_tests.c b/format_tests.c
@@ -76,3 +76,20 @@ UTEST(print_time_z, Basic) {
free(buf);
}
+
+UTEST(print_time_short, 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_short(out, test_time);
+ fclose(out);
+
+ EXPECT_STREQ("2023-12-08 10:30", buf);
+
+ free(buf);
+}