diff options
author | Phaedrus Leeds <mwleeds@protonmail.com> | 2021-10-14 17:38:19 -0700 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2021-10-21 18:14:21 +0100 |
commit | dd48e78652079556bebfe930caad2efa09656584 (patch) | |
tree | fdffd003ce244e13fbd59402b4d317a36e09e114 | |
parent | f753dd214c9a44f462ca013e7357ead8f35538aa (diff) | |
download | flatpak-dd48e78652079556bebfe930caad2efa09656584.tar.gz |
testlibrary: Make remote existence assertions more friendly
Currently the output produced when assert_remote_in_installation() or
assert_remote_not_in_installation() fails is not helpful: it doesn't
mention the remote name or where the assertion was called from. Fix
those problems by rewriting it as a #define.
-rw-r--r-- | tests/testlibrary.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/testlibrary.c b/tests/testlibrary.c index 459582f0..28d68050 100644 --- a/tests/testlibrary.c +++ b/tests/testlibrary.c @@ -3448,19 +3448,21 @@ _is_remote_in_installation (FlatpakInstallation *installation, return FALSE; } -static void -assert_remote_in_installation (FlatpakInstallation *installation, - const char *remote_name) -{ - g_assert_true (_is_remote_in_installation (installation, remote_name)); -} - -static void -assert_remote_not_in_installation (FlatpakInstallation *installation, - const char *remote_name) -{ - g_assert_true (!_is_remote_in_installation (installation, remote_name)); -} +#define assert_remote_in_installation(inst, remote) \ + G_STMT_START { \ + if (!_is_remote_in_installation (inst, remote)) \ + g_assertion_message (G_LOG_DOMAIN, \ + __FILE__, __LINE__, G_STRFUNC, \ + "remote " remote " not found"); \ + } G_STMT_END + +#define assert_remote_not_in_installation(inst, remote) \ + G_STMT_START { \ + if (_is_remote_in_installation (inst, remote)) \ + g_assertion_message (G_LOG_DOMAIN, \ + __FILE__, __LINE__, G_STRFUNC, \ + "remote " remote " was found"); \ + } G_STMT_END static gboolean add_new_remote3 (FlatpakTransaction *transaction, |