From 202d0be7d82b6c35ba444d433e6d64784d460699 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Feb 2015 16:33:32 -0600 Subject: Have a version for those who want parse and have a GVariant pointer --- tests/gtest-gvariant.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/gtest-gvariant.h b/tests/gtest-gvariant.h index 6f93906..38fde0f 100644 --- a/tests/gtest-gvariant.h +++ b/tests/gtest-gvariant.h @@ -89,6 +89,21 @@ testing::AssertionResult expectVariantEqual (const gchar * expectStr, const gcha return expectVariantEqual(expectStr, haveStr, expectv, have); } +testing::AssertionResult expectVariantEqual (const gchar * expectStr, const gchar * haveStr, const char * expect, GVariant * have) +{ + auto havep = std::shared_ptr([have] { + if (have != nullptr) + g_variant_ref_sink(have); + return have; + }(), + [](GVariant * variant) { + if (variant != nullptr) + g_variant_unref(variant); + }); + + return expectVariantEqual(expectStr, haveStr, expect, havep); +} + }; // ns GTestGVariant #define EXPECT_GVARIANT_EQ(expect, have) \ -- cgit v1.2.3