[gjs: 1/2] tests: Add a regression test case for GPtrArrays and GArrays of structures
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] tests: Add a regression test case for GPtrArrays and GArrays of structures
- Date: Tue, 16 Jul 2019 21:46:00 +0000 (UTC)
commit 0ea1eef54098820c5fa6f4a852a18c0c468227d0
Author: Stéphane Seng <seng stephane gmail com>
Date: Tue Jul 16 21:45:42 2019 +0000
tests: Add a regression test case for GPtrArrays and GArrays of structures
Follow-up to https://gitlab.gnome.org/GNOME/gjs/issues/9, where it was
identified that GPtrArrays of structures were not properly marshalled.
This issue was fixed in 3a5e42dbe750ed27534d60de1f78cdefa2ce20b1 but no
regression tests were added nor modified.
This commit adds a marshalling test case for GPtrArrays of structures, with the
same objective than the "C array of structs can be returned with zero
terminator" test case.
This also adds a similar marshalling test case for GArrays of structures, for
completeness.
The new regression test on GPtrArrays fails on versions prior to the fix (on
https://gitlab.gnome.org/GNOME/gjs/-/tags/1.57.2 for example) and passes on
newer versions (on https://gitlab.gnome.org/GNOME/gjs/-/tags/1.57.3 for
example).
Closes #9.
installed-tests/js/testGIMarshalling.js | 36 ++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 27f6bca2..11cbb8eb 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -212,6 +212,13 @@ describe('GArray', function () {
0x73, 0x74, 0x20, 0x2665, 0x20, 0x75, 0x74, 0x66, 0x38])).not.toThrow();
});
});
+
+ describe('of structs', function () {
+ xit('can be returned with transfer full', function () {
+ expect(GIMarshallingTests.garray_boxed_struct_full_return().map(e => e.long_))
+ .toEqual([42, 43, 44]);
+ }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/160');
+ });
});
describe('GByteArray', function() {
@@ -277,21 +284,30 @@ describe('GBytes', function() {
});
describe('GPtrArray', function () {
- const refArray = ['0', '1', '2'];
+ describe('of strings', function() {
+ const refArray = ['0', '1', '2'];
- it('can be passed to a function with transfer none', function () {
- expect(() => GIMarshallingTests.gptrarray_utf8_none_in(refArray))
- .not.toThrow();
- });
+ it('can be passed to a function with transfer none', function () {
+ expect(() => GIMarshallingTests.gptrarray_utf8_none_in(refArray))
+ .not.toThrow();
+ });
- ['return', 'out'].forEach(method => {
- ['none', 'container', 'full'].forEach(transfer => {
- it('can be passed as ' + method + ' with transfer ' + transfer, function () {
- expect(GIMarshallingTests['gptrarray_utf8_' + transfer + '_' + method]())
- .toEqual(refArray);
+ ['return', 'out'].forEach(method => {
+ ['none', 'container', 'full'].forEach(transfer => {
+ it('can be passed as ' + method + ' with transfer ' + transfer, function () {
+ expect(GIMarshallingTests['gptrarray_utf8_' + transfer + '_' + method]())
+ .toEqual(refArray);
+ });
});
});
});
+
+ describe('of structs', function () {
+ xit('can be returned with transfer full', function () {
+ expect(GIMarshallingTests.gptrarray_boxed_struct_full_return().map(e => e.long_))
+ .toEqual([42, 43, 44]);
+ }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/160');
+ });
});
describe('GHashTable', function () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]