1 ;;;; tests for problems in the interface presented to the user/programmer
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
16 ;;;; properties of symbols, e.g. presence of doc strings for public symbols
18 ;;; FIXME: It would probably be good to require here that every
19 ;;; external symbol either has a doc string or has some good excuse
20 ;;; (like being an accessor for a structure which has a doc string).
22 ;;;; tests of interface machinery
24 ;;; APROPOS should accept a package designator, not just a package, and
25 ;;; furthermore do the right thing when it gets a package designator.
26 ;;; (bug reported and fixed by Alexey Dejneka sbcl-devel 2001-10-17)
28 (length (apropos-list "PRINT" :cl
))
29 (length (apropos-list "PRINT"))))
30 ;;; Further, it should correctly deal with the external-only flag (bug
31 ;;; reported by cliini on #lisp IRC 2003-05-30, fixed in sbcl-0.8.0.1x
33 (assert (= (length (apropos-list "" "CL"))
34 (length (apropos-list "" "CL" t
))))
36 (length (apropos-list "" "SB-VM" t
))
37 (length (apropos-list "" "SB-VM"))))
39 ;;; DESCRIBE shouldn't fail on rank-0 arrays (bug reported and fixed
40 ;;; by Lutz Euler sbcl-devel 2002-12-03)
43 (describe #2a
((1 2) (3 4)))
45 ;;; support for DESCRIBE tests
46 (defstruct to-be-described a b
)
47 (defclass forward-describe-class
(forward-describe-ref) (a))
49 ;;; DESCRIBE should run without signalling an error.
50 (describe (make-to-be-described))
54 (describe (find-package :cl
))
56 (describe #(a vector
))
58 ;;; The DESCRIBE-OBJECT methods for built-in CL stuff should do
59 ;;; FRESH-LINE and TERPRI neatly.
60 (dolist (i (list (make-to-be-described :a
14) 12 "a string"
61 #0a0
#(1 2 3) #2a
((1 2) (3 4)) 'sym
:keyword
62 (find-package :keyword
) (list 1 2 3)
63 nil
(cons 1 2) (make-hash-table)
64 (let ((h (make-hash-table)))
65 (setf (gethash 10 h
) 100
68 (make-condition 'simple-error
)
69 (make-condition 'simple-error
:format-control
"fc")
70 #'car
#'make-to-be-described
(lambda (x) (+ x
11))
71 (constantly 'foo
) #'(setf to-be-described-a
)
72 #'describe-object
(find-class 'to-be-described
)
73 (find-class 'forward-describe-class
)
74 (find-class 'forward-describe-ref
) (find-class 'cons
)))
75 (let ((s (with-output-to-string (s)
78 (unless (and (char= #\x
(char s
0))
79 ;; one leading #\NEWLINE from FRESH-LINE or the like, no more
80 (char= #\newline
(char s
1))
81 (char/= #\newline
(char s
2))
82 ;; one trailing #\NEWLINE from TERPRI or the like, no more
84 (and (char= #\newline
(char s
(- n
1)))
85 (char/= #\newline
(char s
(- n
2))))))
86 (error "misbehavior in DESCRIBE of ~S" i
))))
88 ;;; TYPEP, SUBTYPEP, UPGRADED-ARRAY-ELEMENT-TYPE and
89 ;;; UPGRADED-COMPLEX-PART-TYPE should be able to deal with NIL as an
90 ;;; environment argument
92 (subtypep 'fixnum
'integer nil
)
93 (upgraded-array-element-type '(mod 5) nil
)
94 (upgraded-complex-part-type '(single-float 0.0 1.0) nil
)
96 ;;; We should have documentation for our extension package:
97 (assert (documentation (find-package "SB-EXT") t
))
99 ;;; DECLARE should not be a special operator
100 (assert (not (special-operator-p 'declare
)))
102 ;;; WITH-TIMEOUT should accept more than one form in its body.
103 (handler-bind ((sb-ext:timeout
#'continue
))
104 (sb-ext:with-timeout
3