X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-introspect%2Ftest-driver.lisp;h=15e7ccc6fdb3967844c593e89be6dbe87cfb67b6;hb=a8709a851b09f7fd489c5cd7a71bee73f9e1cf9a;hp=ee2454393bb8905fc9e6118b041d6da152e1c2a1;hpb=79709834471d14949535d30ef05fdd2d1c80adac;p=sbcl.git diff --git a/contrib/sb-introspect/test-driver.lisp b/contrib/sb-introspect/test-driver.lisp index ee24543..15e7ccc 100644 --- a/contrib/sb-introspect/test-driver.lisp +++ b/contrib/sb-introspect/test-driver.lisp @@ -75,9 +75,54 @@ (assert (matchp-name :function 'cl-user::one 2)) (sb-profile:unprofile cl-user::one) -;;; Test the xref facility + +;;;; Check correctness of FUNCTION-ARGLIST. + +(assert (equal (function-arglist 'cl-user::one) + '(cl-user::a cl-user::b cl-user::c))) +(assert (equal (function-arglist 'the) + '(type sb-c::value))) + +;;; Check wrt. interplay of generic functions and their methods. + +(defgeneric xuuq (gf.a gf.b &rest gf.rest &key gf.k-X)) +(defmethod xuuq ((m1.a number) m1.b &rest m1.rest &key gf.k-X m1.k-Y m1.k-Z) + (declare (ignore m1.a m1.b m1.rest gf.k-X m1.k-Y m1.k-Z)) + 'm1) +(defmethod xuuq ((m2.a string) m2.b &rest m2.rest &key gf.k-X m1.k-Y m2.k-Q) + (declare (ignore m2.a m2.b m2.rest gf.k-X m1.k-Y m2.k-Q)) + 'm2) + +;; XUUQ's lambda list should look similiar to +;; +;; (GF.A GF.B &REST GF.REST &KEY GF.K-X M1.K-Z M1.K-Y M2.K-Q) +;; +(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)) + (assert (equal required '(gf.a gf.b))) + (assert (null optional)) + (assert (and restp (eql rest 'gf.rest))) + (assert (and keyp + (member 'gf.k-X keys) + (member 'm1.k-Y keys) + (member 'm1.k-Z keys) + (member 'm2.k-Q keys))) + (assert (not allowp)) + (assert (and (not auxp) (null aux))) + (assert (and (not morep) (null more-context) (not more-count)))) + +;;; Check what happens when there's no explicit DEFGENERIC. + +(defmethod kroolz (r1 r2 &optional opt &aux aux) + (declare (ignore r1 r2 opt aux)) + 'kroolz) +(assert (equal (function-arglist #'kroolz) '(r1 r2 &optional opt))) + + +;;;; Test the xref facility (load (merge-pathnames "xref-test.lisp" *load-pathname*)) -;;; Unix success convention for exit codes +;;;; Unix success convention for exit codes (sb-ext:quit :unix-status 0)