334b4898cd26803487c87cb859ef488b76290308
[sbcl.git] / contrib / sb-introspect / test-driver.lisp
1 (require :sb-introspect)
2
3 (defpackage :sb-introspect-test
4   (:use "SB-INTROSPECT" "CL"))
5 (in-package :sb-introspect-test)
6
7 (load (compile-file (merge-pathnames "test.lisp" *load-pathname*)))
8
9 (assert (equal (function-arglist 'cl-user::one)
10                '(cl-user::a cl-user::b cl-user::c)))
11 (assert (equal (function-arglist 'the)
12                '(type sb-c::value)))
13 (assert (= (definition-source-file-write-date
14                (find-definition-source 'cl-user::one))
15            (file-write-date (merge-pathnames "test.lisp" *load-pathname*))))
16
17 (defun matchp (object form-number)
18   (let ((ds (sb-introspect:find-definition-source object)))
19     (and (pathnamep (sb-introspect:definition-source-pathname ds))
20          (= form-number
21             (first (sb-introspect:definition-source-form-path ds))))))
22
23 (assert (matchp 'cl-user::one 2))
24 (assert (matchp #'cl-user::one 2))
25 ; (assert (matchp 'two 2)) ; defgenerics don't work yet
26 (assert (matchp (car (sb-pcl:generic-function-methods #'cl-user::two)) 4))
27
28 ;;; Unix success convention for exit codes
29 (sb-ext:quit :unix-status 0)