summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtests.c
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2023-04-06 18:02:39 +0200
committerMarco Trevisan <mail@3v1n0.net>2023-04-10 16:40:13 +0000
commit99f56c0696b5e2ca9fd1c967d5bbe0b4848c7d69 (patch)
tree355b35c1be3a0d01382d9137c780bd1daaf8e876 /tests/gimarshallingtests.c
parentb7ef3b3ec75f38013d59fdfacefd29e9ab71f28a (diff)
downloadgobject-introspection-99f56c0696b5e2ca9fd1c967d5bbe0b4848c7d69.tar.gz
tests/gimarshallingtests: Add a test case for zero-terminated GValue arrays
Required to test how gjs handles this case.
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r--tests/gimarshallingtests.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 94ccc0b1..6adc978e 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3594,6 +3594,28 @@ gi_marshalling_tests_return_gvalue_flat_array (void)
}
/**
+ * gi_marshalling_tests_return_gvalue_zero_terminated_array:
+ *
+ * Returns: (array zero-terminated) (transfer full): a flat GValue array
+ */
+GValue *
+gi_marshalling_tests_return_gvalue_zero_terminated_array (void)
+{
+ GValue *array = g_new0 (GValue, 4);
+
+ g_value_init (&array[0], G_TYPE_INT);
+ g_value_set_int (&array[0], 42);
+
+ g_value_init (&array[1], G_TYPE_STRING);
+ g_value_set_static_string (&array[1], "42");
+
+ g_value_init (&array[2], G_TYPE_BOOLEAN);
+ g_value_set_boolean (&array[2], TRUE);
+
+ return array;
+}
+
+/**
* gi_marshalling_tests_gvalue_round_trip:
* @value: The first GValue
*