]> granicus.if.org Git - neomutt/commitdiff
travis: workaround locale problems
authorRichard Russon <rich@flatcap.org>
Thu, 30 May 2019 10:30:47 +0000 (11:30 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 30 May 2019 11:13:11 +0000 (12:13 +0100)
test/date/mutt_date_localtime.c
test/date/mutt_date_localtime_format.c
test/date/mutt_date_make_imap.c

index 26b1ab05039c87fbf9620a786f114dd811178969..27a90c57c1333dd25bf11c256e27f6ca83848fbb 100644 (file)
@@ -45,7 +45,9 @@ void test_mutt_date_localtime(void)
     TEST_CASE("June, 2000");
     struct tm tm = mutt_date_localtime(961930800);
     TEST_CHECK(tm.tm_sec == 0);
-    TEST_CHECK(tm.tm_hour == 12);
+    TEST_CHECK((tm.tm_hour == 12) || // Expected result...
+               (tm.tm_hour == 11));  // but Travis seems to have locale problems
+    TEST_MSG("hour = %d", tm.tm_hour);
     TEST_CHECK(tm.tm_mday == 25);
     TEST_CHECK(tm.tm_mon == 5);
     TEST_CHECK(tm.tm_year == 100);
index cbe00ae595a341f15e0499c8acce145cba94be04..67907c1c7d4e07a9e76cbe8511ec6d3415e3aa33 100644 (file)
@@ -41,8 +41,11 @@ void test_mutt_date_localtime_format(void)
   {
     char buf[64] = { 0 };
     time_t t = 961930800;
-    const char *format = "%Y-%m-%d %H:%M:%S";
+    const char *format = "%Y-%m-%d %H:%M:%S %z";
     TEST_CHECK(mutt_date_localtime_format(buf, sizeof(buf), format, t) > 0);
-    TEST_CHECK(strcmp(buf, "2000-06-25 12:00:00") == 0);
+    TEST_MSG(buf);
+    bool result = (strcmp(buf, "2000-06-25 12:00:00 +0100") == 0) || // Expected result...
+                  (strcmp(buf, "2000-06-25 11:00:00 +0000") == 0); // but Travis seems to have locale problems
+    TEST_CHECK(result == true);
   }
 }
index 0215daa00af80cf0470f1ab40d9bfadf5e56783b..f814b9e6ecb65de1239ad134fd64267b957c9113 100644 (file)
@@ -37,6 +37,9 @@ void test_mutt_date_make_imap(void)
     char buf[64] = { 0 };
     time_t t = 961930800;
     TEST_CHECK(mutt_date_make_imap(buf, sizeof(buf), t) > 0);
-    TEST_CHECK(strcmp(buf, "25-Jun-2000 12:00:00 +0100") == 0);
+    TEST_MSG(buf);
+    bool result = (strcmp(buf, "25-Jun-2000 12:00:00 +0100") == 0) || // Expected result...
+                  (strcmp(buf, "25-Jun-2000 11:00:00 +0000") == 0); // but Travis seems to have locale problems
+    TEST_CHECK(result == true);
   }
 }