summaryrefslogtreecommitdiff
path: root/Lisp/tests.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2007-09-14 00:58:42 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2007-09-14 00:58:42 +0200
commitc5f208daed4eb63d5a8ff3f8a92bac2a9df08002 (patch)
treebfb86ff91852d0f1cb695f34cc632dd6bb8ab988 /Lisp/tests.lisp
parent36b60878579dad8e74ed785a36b1028bff7bad45 (diff)
Implement a typespec parser for the GNU Objective-C runtime.
darcs-hash:b1e4d767b18dce617c5df6920ca592111604c2a6
Diffstat (limited to 'Lisp/tests.lisp')
-rw-r--r--Lisp/tests.lisp64
1 files changed, 63 insertions, 1 deletions
diff --git a/Lisp/tests.lisp b/Lisp/tests.lisp
index eec76ee..7d6ddb9 100644
--- a/Lisp/tests.lisp
+++ b/Lisp/tests.lisp
@@ -1,7 +1,11 @@
(defpackage #:mulk.objective-cl.tests
(:nicknames #:objcl-tests #:objective-cl-tests #:mulk.objcl-tests)
(:use #:lift #:mulk.objective-cl #:cl)
- (:export #:run-all-tests))
+ (:export #:run-all-tests)
+ (:shadowing-import-from #:objcl
+ #:struct #:union #:pointer #:oneway #:out #:in
+ #:inout #:const #:parse-typespec #:objc-class
+ #:bit-field))
(in-package #:mulk.objective-cl.tests)
@@ -64,6 +68,64 @@
withObject: [NSObject class]]))))
+(deftestsuite parsing-typespecs (objective-cl)
+ ()
+ (:equality-test #'equal)
+ (:tests
+ ((ensure-same (parse-typespec "@0:4{_NSRange=II}8")
+ '(id ())))
+ ((ensure-same (parse-typespec ":4{_NSRange=II}8")
+ '(selector ())))
+ ((ensure-same (parse-typespec "{_NSRange=II}8")
+ '(struct () "_NSRange"
+ (:unsigned-int ())
+ (:unsigned-int ()))))
+ ((ensure-same (parse-typespec "rnNoV^V[10rjd]4")
+ ;; Actually, the order of the qualifiers is not
+ ;; important, which means that this test is too dumb.
+ '(pointer (oneway out inout in const)
+ (array (oneway)
+ 10
+ (complex (const) (:double nil))))))
+ ((ensure-same (parse-typespec "(?=)")
+ '(union () "?")))
+ ((ensure-same (parse-typespec "{?=rb123rjf456iii}")
+ '(struct () "?"
+ (bit-field (const) 123 456
+ (complex (const) (:float ())))
+ (:int ())
+ (:int ())
+ (:int ()))))
+ ((ensure-same (parse-typespec "^[100{?=ii}]")
+ '(pointer ()
+ (array () 100
+ (struct () "?" (:int ()) (:int ()))))))
+ ((ensure-same (parse-typespec "{?=BcCsSiIlLqQfd@#:*?}")
+ '(struct () "?"
+ (:boolean ())
+ (:char ())
+ (:unsigned-char ())
+ (:short ())
+ (:unsigned-short ())
+ (:int ())
+ (:unsigned-int ())
+ (:long ())
+ (:unsigned-long ())
+ (:long-long ())
+ (:unsigned-long-long ())
+ (:float ())
+ (:double ())
+ (id ()) (objc-class ()) (selector ())
+ (:string ())
+ (:unknown ()))))
+ ((ensure-same (parse-typespec "{Mulk=*{Untermulk={Unteruntermulk=}}i}")
+ '(struct () "Mulk"
+ (:string ())
+ (struct () "Untermulk"
+ (struct () "Unteruntermulk"))
+ (:int ()))))))
+
+
(deftestsuite data-coercion (objective-cl)
()
(:equality-test #'objc-equal)