1 ;;;; tests for the INSPECT function
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.
14 (load "assertoid.lisp")
15 (load "test-util.lisp")
16 (use-package "ASSERTOID")
17 (use-package "TEST-UTIL")
19 (defun test-inspect (object control
)
20 (let* ((control (if (listp control
)
21 (format nil
"~{~A~%~}" control
)
23 (*standard-input
* (make-string-input-stream control
))
24 (output (make-string-output-stream))
25 (*standard-output
* output
))
27 (get-output-stream-string output
)))
29 (defclass class-with-prototype-print-error
()
32 (defmethod print-object ((object class-with-prototype-print-error
) stream
)
33 (print-unreadable-object (object stream
:type t
)
34 (princ (slot-value object
'will-be-unbound
) stream
)))
36 (with-test (:name
(inspect :no-error print-object
:lp-454682
))
37 (let ((class (find-class 'class-with-prototype-print-error
)))
39 (test-inspect class
'("q"))))
40 ;; Prototype may not be initialized at this point.
41 (assert (search "PROTOTYPE: " (test)))
42 ;; Force protocol initialization and test again.
43 (sb-mop:class-prototype class
)
44 (assert (search "PROTOTYPE: " (test))))))