[glib: 1/2] gio/tests/g-file-info: don't assume million-in-one events don't happen




commit 289f8be1b397a453cfcf35641455f3ae5fb4faeb
Author: Ross Burton <ross burton arm com>
Date:   Tue Jul 6 19:26:03 2021 +0100

    gio/tests/g-file-info: don't assume million-in-one events don't happen
    
    The modification time test creates a file, gets the modification time in
    seconds, then gets the modification time in microseconds and assumes
    that the difference between the two has to be above 0.
    
    As rare as this may be, it can happen:
    
    $ stat g-file-info-test-50A450 -c %y
    2021-07-06 18:24:56.000000767 +0100
    
    Change the test to simply assert that the difference not negative to
    handle this case.

 gio/tests/g-file-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
index c11c50462..fd0c64b55 100644
--- a/gio/tests/g-file-info.c
+++ b/gio/tests/g-file-info.c
@@ -178,7 +178,7 @@ test_g_file_info_modification_time (void)
   g_assert_nonnull (dt_usecs);
 
   ts = g_date_time_difference (dt_usecs, dt);
-  g_assert_cmpint (ts, >, 0);
+  g_assert_cmpint (ts, >=, 0);
   g_assert_cmpint (ts, <, G_USEC_PER_SEC);
 
   /* Try round-tripping the modification time. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]