diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-05-12 22:47:48 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-05-12 22:51:17 +0200 |
commit | b29b3ec7c9f4f9f6d979aff1bfc3dc6cb05970d2 (patch) | |
tree | d7f998f0462764d0df0a159fcc538d195097b01f /tests | |
parent | 89908f752a9467f0659c2d93aaf7ee1b99716119 (diff) | |
download | gobject-introspection-b29b3ec7c9f4f9f6d979aff1bfc3dc6cb05970d2.tar.gz |
Add tests for returning zero-terminated arrays of non-strings
gjs has always supported zero-terminated arrays of strings, and
nothing else. Now that this changed, we need to test it.
https://bugzilla.gnome.org/show_bug.cgi?id=634253
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gimarshallingtests.c | 23 | ||||
-rw-r--r-- | tests/gimarshallingtests.h | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 77b6b741..56df373a 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -1283,6 +1283,29 @@ gi_marshalling_tests_array_zero_terminated_return (void) } /** + * gi_marshalling_tests_array_zero_terminated_return_struct: + * Returns: (array zero-terminated=1) (transfer full): + */ +GIMarshallingTestsBoxedStruct ** +gi_marshalling_tests_array_zero_terminated_return_struct (void) +{ + GIMarshallingTestsBoxedStruct **ret = (GIMarshallingTestsBoxedStruct**) g_new (gpointer, 4); + + ret[0] = gi_marshalling_tests_boxed_struct_new (); + ret[0]->long_ = 42; + + ret[1] = gi_marshalling_tests_boxed_struct_new (); + ret[1]->long_ = 43; + + ret[2] = gi_marshalling_tests_boxed_struct_new (); + ret[2]->long_ = 44; + + ret[3] = NULL; + + return ret; +} + +/** * gi_marshalling_tests_array_zero_terminated_in: * @utf8s: (array zero-terminated=1) (transfer none): */ diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 752147b6..f7b59b3b 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -8,6 +8,7 @@ #define __GI_MARSHALLING_TESTS_H__ typedef struct _GIMarshallingTestsSimpleStruct GIMarshallingTestsSimpleStruct; +typedef struct _GIMarshallingTestsBoxedStruct GIMarshallingTestsBoxedStruct; /* Constants */ @@ -290,6 +291,7 @@ void gi_marshalling_tests_array_inout (gint **ints, gint *length); /* Zero-terminated */ gchar **gi_marshalling_tests_array_zero_terminated_return (void); +GIMarshallingTestsBoxedStruct **gi_marshalling_tests_array_zero_terminated_return_struct (void); void gi_marshalling_tests_array_zero_terminated_in (gchar **utf8s); @@ -540,10 +542,10 @@ GIMarshallingTestsPointerStruct *gi_marshalling_tests_pointer_struct_returnv (vo void gi_marshalling_tests_pointer_struct_inv (GIMarshallingTestsPointerStruct *struct_); -typedef struct { +struct _GIMarshallingTestsBoxedStruct { glong long_; GStrv g_strv; -} GIMarshallingTestsBoxedStruct; +}; GType gi_marshalling_tests_boxed_struct_get_type (void) G_GNUC_CONST; |