1 (defpackage #:gtype-tests
2 (:use
#:cl
#:iter
#:gobject
#:gobject.ffi
#:5am
)
3 (:export
#:run-all-tests
)
4 (:import-from
#:gobject.ffi
#:%gtype
#:gtype
#:gtype-name
#:gtype-%id
#:gtype-id
#:invalidate-gtypes
))
6 (in-package #:gtype-tests
)
12 (defun run-all-tests ()
18 (finishes (%gtype
"gint"))
19 (finishes (%gtype
"glong"))
20 (finishes (%gtype
+g-type-pointer
+)))
23 (is (eq (%gtype
"gint") (%gtype
"gint")))
24 (is (eq (%gtype
"GObject") (%gtype
"GObject")))
25 (is (not (eq (%gtype
"gint") (%gtype
"GObject"))))
26 (is (eq (%gtype
"gchararray") (%gtype
+g-type-string
+))))
29 (is (null (%gtype
0)))
30 (is (null (%gtype nil
)))
31 (signals warning
(%gtype
"foobarbaz"))
32 (signals error
(%gtype
1)))
35 (is (string= (gtype-name (%gtype
"gint")) "gint"))
36 (is (eql (gtype-id (%gtype
"gint")) +g-type-int
+)))
41 (let ((type (%gtype
"gint")))
42 (is (eql (gtype-id type
) +g-type-int
+))
44 (is (null (gtype-%id type
)))
45 (is (eql (gtype-id type
) +g-type-int
+))
47 (is (eq type
(%gtype
"gint")))
49 (is (eq type
(%gtype
+g-type-int
+)))))
52 (let ((type (%gtype
"gint")))
54 (is (null (gtype-%id type
)))
56 (is (not (null (gethash +g-type-int
+ gobject.ffi
::*id-to-gtype
*))))
57 (is (not (null (gtype-%id type
))))))
61 (defvar *gi
* (%gtype
+g-type-int
+))
64 (is (eq *gi
* (%gtype
+g-type-int
+)))
65 (is (eq (gtype +g-type-int
+) (%gtype
+g-type-int
+))))