[gjs/ewlsh/fix-null-pointers] Add test for not-nullable gpointer parameters.



commit 358848f56a07230aff9eca0199c7b727e05d3c9f
Author: Evan Welsh <noreply evanwelsh com>
Date:   Thu Oct 1 12:39:42 2020 -0500

    Add test for not-nullable gpointer parameters.
    
    Use GLib.str_hash until Regress has a suitable test case.

 installed-tests/js/testGLib.js | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/installed-tests/js/testGLib.js b/installed-tests/js/testGLib.js
index d25e3785..4e5d23c8 100644
--- a/installed-tests/js/testGLib.js
+++ b/installed-tests/js/testGLib.js
@@ -133,6 +133,14 @@ describe('GLib string function overrides', function () {
         numExpectedWarnings = 0;
     });
 
+    // TODO: Add Regress.func_not_nullable_untyped_gpointer_in and move to testRegress.js
+    it('GLib.str_hash errors when marshalling null to a not-nullable parameter', function () {
+        // This tests that we don't marshal null to a not-nullable untyped gpointer.
+        expect(() => GLib.str_hash(null)).toThrowError(
+            /Argument [a-z]+ may not be null/
+        );
+    });
+
     it('GLib.stpcpy', function () {
         expect(() => GLib.stpcpy('dest', 'src')).toThrowError(/not introspectable/);
     });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]