diff options
author | Colin Walters <walters@verbum.org> | 2012-11-29 14:54:01 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2012-11-29 14:54:01 -0500 |
commit | f4bb1c1b18085ddbd22596de7f72993a2fd76c2d (patch) | |
tree | 7b31a7787102c25faaa0c71589ba5a725e8cc713 /tests/gimarshallingtests.c | |
parent | 3c8c01c28a5d7ee94ec74be6c205942ddae2eb59 (diff) | |
download | gobject-introspection-f4bb1c1b18085ddbd22596de7f72993a2fd76c2d.tar.gz |
gimarshallingtests: Add a utf8-in-bytearray test
Will be used by gjs
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r-- | tests/gimarshallingtests.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 9a533293..7f7abf81 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -1065,6 +1065,24 @@ gi_marshalling_tests_utf8_none_in (const gchar *utf8) } /** + * gi_marshalling_tests_utf8_as_uint8array_in: + * @array: (array length=len) (element-type guint8): Byte data that happens to be UTF-8 + * @len: Length + * + * Takes data that happens to be UTF-8 as a byte array, to test + * binding conversion from their string type (e.g. JavaScript's + * UTF-16) to UTF-8. + */ +void +gi_marshalling_tests_utf8_as_uint8array_in (const guint8 *array, + gsize len) +{ + gsize orig_len = strlen (GI_MARSHALLING_TESTS_CONSTANT_UTF8); + g_assert_cmpint (orig_len, ==, len); + g_assert (memcmp (GI_MARSHALLING_TESTS_CONSTANT_UTF8, array, len) == 0); +} + +/** * gi_marshalling_tests_utf8_none_out: * @utf8: (out) (transfer none): */ |