summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2021-10-14 17:38:19 -0700
committerPhaedrus Leeds <mwleeds@protonmail.com>2021-10-14 18:19:24 -0700
commit95f3e2d85b071a43c33723a1ddea952d3e3f0719 (patch)
treec0e0302b6988605a0192095f9ba4cdf2e193e898
parente30c3e357acb5ea0b5765ce0c574b88ed8319828 (diff)
downloadflatpak-minor-test-fixes.tar.gz
testlibrary: Make remote existence assertions more friendlyminor-test-fixes
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.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/testlibrary.c b/tests/testlibrary.c
index 98c6a0b6..e7e64449 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,