[glib: 4/6] tests: Switch some assertions around
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 4/6] tests: Switch some assertions around
- Date: Tue, 5 Nov 2019 10:59:14 +0000 (UTC)
commit a86c994255c760b36b6ea3590a31dd45d3148d68
Author: Philip Withnall <withnall endlessm com>
Date: Tue Nov 5 10:19:36 2019 +0000
tests: Switch some assertions around
In general, we should aim to always check a `GError` before checking a
boolean, since the error message from the `GError` gives us a lot more
information about failure, which helps with debugging.
Signed-off-by: Philip Withnall <withnall endlessm com>
glib/tests/bookmarkfile.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/tests/bookmarkfile.c b/glib/tests/bookmarkfile.c
index 75daeaf22..738452e49 100644
--- a/glib/tests/bookmarkfile.c
+++ b/glib/tests/bookmarkfile.c
@@ -49,20 +49,20 @@ test_to_file (void)
filename = g_test_get_filename (G_TEST_DIST, "bookmarks", "valid-01.xbel", NULL);
res = g_bookmark_file_load_from_file (bookmark, filename, &error);
- g_assert_true (res);
g_assert_no_error (error);
+ g_assert_true (res);
res = g_bookmark_file_to_file (bookmark, "out.xbel", &error);
- g_assert_true (res);
g_assert_no_error (error);
+ g_assert_true (res);
res = g_file_get_contents (filename, &in, NULL, &error);
- g_assert_true (res);
g_assert_no_error (error);
+ g_assert_true (res);
res = g_file_get_contents ("out.xbel", &out, NULL, &error);
- g_assert_true (res);
g_assert_no_error (error);
+ g_assert_true (res);
remove ("out.xbel");
g_assert_cmpstr (in, ==, out);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]