summaryrefslogtreecommitdiff
path: root/shared/nm-utils
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-05-14 07:46:24 +0200
committerThomas Haller <thaller@redhat.com>2019-05-23 18:09:49 +0200
commitae7f32e03b43273f118912899b72fcfa13e99c46 (patch)
tree1db8ddab4f5715f2dfc01e3ac71a2489ffff8558 /shared/nm-utils
parent5d3b033072fe754a0fd46ba9bce60cefd955a406 (diff)
downloadNetworkManager-ae7f32e03b43273f118912899b72fcfa13e99c46.tar.gz
shared/tests: add nmtst_variant_from_string() util
Diffstat (limited to 'shared/nm-utils')
-rw-r--r--shared/nm-utils/nm-test-utils.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index 26190a7460..053c4fa4ed 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -2140,6 +2140,25 @@ typedef enum {
#endif /* __NM_CONNECTION_H__ */
+static inline GVariant *
+nmtst_variant_from_string (const GVariantType *variant_type,
+ const char *variant_str)
+{
+ GVariant *variant;
+ GError *error = NULL;
+
+ g_assert (variant_type);
+ g_assert (variant_str);
+
+ variant = g_variant_parse (variant_type,
+ variant_str,
+ NULL,
+ NULL,
+ &error);
+ nmtst_assert_success (variant, error);
+ return variant;
+}
+
/*****************************************************************************/
static inline void