diff options
author | Eric Blake <eblake@redhat.com> | 2023-05-11 21:10:15 -0500 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2023-06-02 11:24:18 -0500 |
commit | 3a5925922520f934f7b0f96d0c65a041540d7738 (patch) | |
tree | cd4d0f236aaaeadafd835d642c1d6aafe77a7359 /disas/microblaze.c | |
parent | 5cf899e21555d57b9ee1d0a8256f9a2230e88658 (diff) |
test-cutils: Avoid g_assert in unit tests
glib documentation[1] is clear: g_assert() should be avoided in unit
tests because it is ineffective if G_DISABLE_ASSERT is defined; unit
tests should stick to constructs based on g_assert_true() instead.
Note that since commit 262a69f428, we intentionally state that you
cannot define G_DISABLE_ASSERT while building qemu; but our code can
be copied to other projects without that restriction, so we should be
consistent.
For most of the replacements in this patch, using g_assert_cmpstr()
would be a regression in quality - although it would helpfully display
the string contents of both pointers on test failure, here, we really
do care about pointer equality, not just string content equality. But
when a NULL pointer is expected, g_assert_null works fine.
[1] https://libsoup.org/glib/glib-Testing.html#g-assert
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230522190441.64278-2-eblake@redhat.com>
Diffstat (limited to 'disas/microblaze.c')
0 files changed, 0 insertions, 0 deletions