]> gitweb.factorcode.org Git - factor.git/commitdiff
gobject-introspection.ffi: new tests
authorBjörn Lindqvist <bjourne@gmail.com>
Sat, 28 May 2016 14:46:24 +0000 (16:46 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Sat, 28 May 2016 14:46:24 +0000 (16:46 +0200)
basis/gobject-introspection/ffi/ffi-tests.factor [new file with mode: 0644]

diff --git a/basis/gobject-introspection/ffi/ffi-tests.factor b/basis/gobject-introspection/ffi/ffi-tests.factor
new file mode 100644 (file)
index 0000000..ba45684
--- /dev/null
@@ -0,0 +1,30 @@
+USING: accessors alien.c-types compiler.units
+gobject-introspection.ffi gobject-introspection.repository kernel
+tools.test ;
+IN: gobject-introspection.ffi.tests
+
+! callback
+{
+    T{ return
+       { type T{ simple-type { name "none" } } }
+       { transfer-ownership "none" }
+    }
+} [
+    "blah" "blah" f
+    "none" f simple-type boa "none" return boa
+    { } f callback boa return>>
+] unit-test
+
+! def-callback-type
+{ } [
+    [
+        "blah" "blah"
+        f "none" f simple-type boa "none" return boa
+        { } f callback boa def-callback-type
+    ] with-compilation-unit
+] unit-test
+
+! return-c-type
+{ void } [
+    "none" f simple-type boa "none" return boa return-c-type
+] unit-test