diff options
author | Simon McVittie <smcv@debian.org> | 2020-08-23 18:34:04 +0100 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-09-19 21:55:32 -0700 |
commit | ae2952e6167be60663d587a605e38e97d5f4978c (patch) | |
tree | b24ee08141f87c38d8d24a873a5f0f5b2336eed3 /tests | |
parent | 503723cf4472d70fd7c7e21a6137a82a6b116e18 (diff) | |
download | gobject-introspection-ae2952e6167be60663d587a605e38e97d5f4978c.tar.gz |
girmarshalling tests: Diagnose GValue not holding enum/flagswip/smcv/test-more-flags
If g_value_get_enum() or g_value_get_flags() is about to fail with a
precondition check failure, we can improve diagnostics by issuing
a more informative critical warning.
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gimarshallingtests.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 571b7a2e..483fb619 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3445,6 +3445,8 @@ gi_marshalling_tests_gvalue_in_with_modification (GValue *value) void gi_marshalling_tests_gvalue_in_enum (GValue *value) { + if (!G_VALUE_HOLDS_ENUM (value)) + g_critical ("Expected enum, got %s", G_VALUE_TYPE_NAME (value)); g_assert (g_value_get_enum (value) == GI_MARSHALLING_TESTS_ENUM_VALUE3); } @@ -3455,6 +3457,8 @@ gi_marshalling_tests_gvalue_in_enum (GValue *value) void gi_marshalling_tests_gvalue_in_flags (GValue *value) { + if (!G_VALUE_HOLDS_FLAGS (value)) + g_critical ("Expected flags, got %s", G_VALUE_TYPE_NAME (value)); g_assert_cmpint (g_value_get_flags (value), ==, GI_MARSHALLING_TESTS_FLAGS_VALUE3); } |