[glib/wip/pwithnall/fix-bsd-spawn-test] tests: Make a string comparison on an error string more relaxed




commit 351517046159835dfbfee11e18e14e8161558384
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Apr 8 12:25:59 2022 +0100

    tests: Make a string comparison on an error string more relaxed
    
    It currently fails on FreeBSD with:
    ```
    Bail out! GLib:ERROR:../glib/tests/spawn-test.c:111:test_spawn_basics: assertion failed (erroutput == 
"sort: cannot read: non-existing-file.txt: No such file or directory\n"): ("sort: No such file or 
directory\n" == "sort: cannot read: non-existing-file.txt: No such file or directory\n")
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/tests/spawn-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/spawn-test.c b/glib/tests/spawn-test.c
index 0d0604d00a..42599d72f1 100644
--- a/glib/tests/spawn-test.c
+++ b/glib/tests/spawn-test.c
@@ -107,8 +107,8 @@ test_spawn_basics (void)
                                       NULL, &erroutput, NULL, &err);
   g_assert_no_error (err);
   g_assert_true (result);
-  g_assert_cmpstr (erroutput, ==,
-                   "sort: cannot read: non-existing-file.txt: No such file or directory\n");
+  g_assert_true (g_str_has_prefix (erroutput, "sort: "));
+  g_assert_nonnull (strstr (erroutput, "No such file or directory"));
 
   g_free (erroutput);
   erroutput = NULL;


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