1.0.27.30: minor octets.lisp cleanup
[sbcl.git] / contrib / sb-introspect / test-driver.lisp
index 15e7ccc..2e82fe0 100644 (file)
@@ -7,12 +7,12 @@
 (with-compilation-unit (:source-plist (list :test-outer "OUT"))
   (load (compile-file (merge-pathnames "test.lisp" *load-pathname*))))
 
 (with-compilation-unit (:source-plist (list :test-outer "OUT"))
   (load (compile-file (merge-pathnames "test.lisp" *load-pathname*))))
 
-(assert (equal (function-arglist 'cl-user::one)
+(assert (equal (function-lambda-list 'cl-user::one)
                '(cl-user::a cl-user::b cl-user::c)))
                '(cl-user::a cl-user::b cl-user::c)))
-(assert (equal (function-arglist 'the)
-               '(type sb-c::value)))
+(assert (equal (function-lambda-list 'the)
+               '(sb-c::value-type sb-c::form)))
 
 
-(assert (equal (function-arglist #'(sb-pcl::slow-method cl-user::j (t)))
+(assert (equal (function-lambda-list #'(sb-pcl::slow-method cl-user::j (t)))
                '(sb-pcl::method-args sb-pcl::next-methods)))
 
 (let ((source (find-definition-source #'cl-user::one)))
                '(sb-pcl::method-args sb-pcl::next-methods)))
 
 (let ((source (find-definition-source #'cl-user::one)))
 (assert (matchp-name :method-combination 'cl-user::r 26))
 (assert (matchp-name :setf-expander 'cl-user::s 27))
 
 (assert (matchp-name :method-combination 'cl-user::r 26))
 (assert (matchp-name :setf-expander 'cl-user::s 27))
 
+(let ((fin (make-instance 'sb-mop:funcallable-standard-object)))
+  (sb-mop:set-funcallable-instance-function fin #'cl-user::one)
+  (assert (matchp fin 2)))
+
 (sb-profile:profile cl-user::one)
 (assert (matchp-name :function 'cl-user::one 2))
 (sb-profile:unprofile cl-user::one)
 
 
 (sb-profile:profile cl-user::one)
 (assert (matchp-name :function 'cl-user::one 2))
 (sb-profile:unprofile cl-user::one)
 
 
-;;;; Check correctness of FUNCTION-ARGLIST.
+;;;; Check correctness of FUNCTION-LAMBDA-LIST.
 
 
-(assert (equal (function-arglist 'cl-user::one)
+(assert (equal (function-lambda-list 'cl-user::one)
                '(cl-user::a cl-user::b cl-user::c)))
                '(cl-user::a cl-user::b cl-user::c)))
-(assert (equal (function-arglist 'the)
-               '(type sb-c::value)))
+(assert (equal (function-lambda-list 'the)
+               '(sb-c::value-type sb-c::form)))
 
 ;;; Check wrt. interplay of generic functions and their methods.
 
 
 ;;; Check wrt. interplay of generic functions and their methods.
 
 ;;
 (multiple-value-bind (required optional restp rest keyp keys allowp
                       auxp aux morep more-context more-count)
 ;;
 (multiple-value-bind (required optional restp rest keyp keys allowp
                       auxp aux morep more-context more-count)
-    (sb-int:parse-lambda-list (function-arglist #'xuuq))
+    (sb-int:parse-lambda-list (function-lambda-list #'xuuq))
   (assert (equal required '(gf.a gf.b)))
   (assert (null optional))
   (assert (and restp (eql rest 'gf.rest)))
   (assert (equal required '(gf.a gf.b)))
   (assert (null optional))
   (assert (and restp (eql rest 'gf.rest)))
 (defmethod kroolz (r1 r2 &optional opt &aux aux)
   (declare (ignore r1 r2 opt aux))
   'kroolz)
 (defmethod kroolz (r1 r2 &optional opt &aux aux)
   (declare (ignore r1 r2 opt aux))
   'kroolz)
-(assert (equal (function-arglist #'kroolz) '(r1 r2 &optional opt)))
+(assert (equal (function-lambda-list #'kroolz) '(r1 r2 &optional opt)))
+
+;;;; Test finding a type that isn't one
+(assert (not (find-definition-sources-by-name 'fboundp :type)))
+
+;;;; Check correctness of DEFTYPE-LAMBDA-LIST.
+(deftype foobar-type
+    (&whole w &environment e r1 r2 &optional o &rest rest &key k1 k2 k3)
+  (declare (ignore w e r1 r2 o rest k1 k2 k3))
+  nil)
+
+(assert (multiple-value-bind (arglist found?) (deftype-lambda-list 'foobar-type)
+          (and found?
+               (equal arglist '(&whole w &environment e
+                                r1 r2 &optional o &rest rest &key k1 k2 k3)))))
+
+(assert (equal (multiple-value-list (deftype-lambda-list (gensym)))
+               '(nil nil)))
 
 
 ;;;; Test the xref facility
 
 
 ;;;; Test the xref facility