Add compiler-macro that handles gtype calls with constant args
[cl-gtk2.git] / glib / gobject.type-tests.lisp
index b073963..7f61d01 100644 (file)
@@ -1,7 +1,7 @@
 (defpackage #:gtype-tests
   (:use #:cl #:iter #:gobject #:gobject.ffi #:5am)
   (:export #:run-all-tests)
-  (:import-from #:gobject.ffi #:gtype #:gtype-name #:gtype-%id #:gtype-id #:invalidate-gtypes))
+  (:import-from #:gobject.ffi #:%gtype #:gtype #:gtype-name #:gtype-%id #:gtype-id #:invalidate-gtypes))
 
 (in-package #:gtype-tests)
 
 ;; Normal things
 
 (test normal.1
-  (finishes (gtype "gint"))
-  (finishes (gtype "glong"))
-  (finishes (gtype +g-type-pointer+)))
+  (finishes (%gtype "gint"))
+  (finishes (%gtype "glong"))
+  (finishes (%gtype +g-type-pointer+)))
 
 (test normal.eq
-  (is (eq (gtype "gint") (gtype "gint")))
-  (is (eq (gtype "GObject") (gtype "GObject")))
-  (is (not (eq (gtype "gint") (gtype "GObject"))))
-  (is (eq (gtype "gchararray") (gtype +g-type-string+))))
+  (is (eq (%gtype "gint") (%gtype "gint")))
+  (is (eq (%gtype "GObject") (%gtype "GObject")))
+  (is (not (eq (%gtype "gint") (%gtype "GObject"))))
+  (is (eq (%gtype "gchararray") (%gtype +g-type-string+))))
 
 (test normal.boundary
-  (is (null (gtype 0)))
-  (is (null (gtype nil)))
-  (signals warning (gtype "foobarbaz"))
-  (signals error (gtype 1)))
+  (is (null (%gtype 0)))
+  (is (null (%gtype nil)))
+  (signals warning (%gtype "foobarbaz"))
+  (signals error (%gtype 1)))
 
 (test normal.trans
-  (is (string= (gtype-name (gtype "gint")) "gint"))
-  (is (eql (gtype-id (gtype "gint")) +g-type-int+)))
+  (is (string= (gtype-name (%gtype "gint")) "gint"))
+  (is (eql (gtype-id (%gtype "gint")) +g-type-int+)))
 
 ;; Clear mappings
 
 (test clear.simple
-  (let ((type (gtype "gint")))
+  (let ((type (%gtype "gint")))
     (is (eql (gtype-id type) +g-type-int+))
     (invalidate-gtypes)
     (is (null (gtype-%id type)))
     (is (eql (gtype-id type) +g-type-int+))
     (invalidate-gtypes)
-    (is (eq type (gtype "gint")))
+    (is (eq type (%gtype "gint")))
     (invalidate-gtypes)
-    (is (eq type (gtype +g-type-int+)))))
+    (is (eq type (%gtype +g-type-int+)))))
 
 (test clear.1
-  (let ((type (gtype "gint")))
+  (let ((type (%gtype "gint")))
     (invalidate-gtypes)
     (is (null (gtype-%id type)))
-    (gtype +g-type-int+)
+    (%gtype +g-type-int+)
     (is (not (null (gethash +g-type-int+ gobject.ffi::*id-to-gtype*))))
     (is (not (null (gtype-%id type))))))
 
 ;; Core saving
 
-(defvar *gi* (gtype +g-type-int+))
+(defvar *gi* (%gtype +g-type-int+))
 
 (test core.saving
-  (is (eq *gi* (gtype +g-type-int+))))
+  (is (eq *gi* (%gtype +g-type-int+)))
+  (is (eq (gtype +g-type-int+) (%gtype +g-type-int+))))