diff options
author | Phaedrus Leeds <mwleeds@protonmail.com> | 2021-10-14 17:38:19 -0700 |
---|---|---|
committer | Phaedrus Leeds <mwl458@gmail.com> | 2022-01-04 10:44:37 -0800 |
commit | 9f2baafb44e236f51d53e4dc3a40ab69d72a9079 (patch) | |
tree | 552466741ced908b640f534eebd384c96a0622fc | |
parent | 7a0cd0ee85a8bef94d265acee07b11e5b55f39f4 (diff) | |
download | flatpak-9f2baafb44e236f51d53e4dc3a40ab69d72a9079.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.
(cherry picked from commit dd48e78652079556bebfe930caad2efa09656584)
-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, |