summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-12-12 14:42:27 +0100
committerJiří Klimeš <jklimes@redhat.com>2014-12-15 14:11:03 +0100
commit6603e7ffde2b6a90206ea2e321cdff33d5b1c680 (patch)
tree2998c89adbdfc4badd0cd1d56aebd73fa0d25f3f /include
parentafb0e2c53c4c17dfdb89d63b39db5101cc864704 (diff)
downloadNetworkManager-6603e7ffde2b6a90206ea2e321cdff33d5b1c680.tar.gz
tests: mute coverity for CHECKED_RETURN (CWE-252) in tests
Error: CHECKED_RETURN (CWE-252): [#def12] NetworkManager-0.9.11.0/libnm-core/tests/test-general.c:348: check_return: Calling "nm_setting_verify" without checking return value (as is done elsewhere 37 out of 45 times). ...
Diffstat (limited to 'include')
-rw-r--r--include/nm-test-utils.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h
index 44a81bbe51..dcfa46eba3 100644
--- a/include/nm-test-utils.h
+++ b/include/nm-test-utils.h
@@ -945,6 +945,39 @@ nmtst_assert_connection_unnormalizable (NMConnection *con,
g_clear_error (&error);
}
+inline static void
+nmtst_assert_setting_verifies (NMSetting *setting)
+{
+ /* assert that the setting verifies without an error */
+
+ GError *error = NULL;
+ gboolean success;
+
+ g_assert (NM_IS_SETTING (setting));
+
+ success = nm_setting_verify (setting, NULL, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+}
+
+inline static void
+nmtst_assert_setting_verify_fails (NMSetting *setting,
+ GQuark expect_error_domain,
+ gint expect_error_code)
+{
+ /* assert that the setting verification fails */
+
+ GError *error = NULL;
+ gboolean success;
+
+ g_assert (NM_IS_SETTING (setting));
+
+ success = nm_setting_verify (setting, NULL, &error);
+ nmtst_assert_error (error, expect_error_domain, expect_error_code, NULL);
+ g_assert (!success);
+ g_clear_error (&error);
+}
+
#endif
#ifdef __NM_UTILS_H__