2
;;;; Author: Paul Dietz
3
;;;; Created: Tue May 6 05:53:32 2003
4
;;;; Contains: Tests of SLOT-BOUNDP
8
;;; SLOT-BOUNDP is extensively tested in other files as well
10
(defclass slot-boundp-class-01 ()
11
(a (b :initarg :b) (c :initform 'x)))
13
(deftest slot-boundp.1
14
(let ((obj (make-instance 'slot-boundp-class-01)))
18
(deftest slot-boundp.2
19
(let ((obj (make-instance 'slot-boundp-class-01)))
20
(setf (slot-value obj 'a) nil)
21
(notnot-mv (slot-boundp obj 'a)))
24
(deftest slot-boundp.3
25
(let ((obj (make-instance 'slot-boundp-class-01 :b nil)))
26
(notnot-mv (slot-boundp obj 'b)))
29
(deftest slot-boundp.4
30
(let ((obj (make-instance 'slot-boundp-class-01)))
31
(notnot-mv (slot-boundp obj 'c)))
34
(deftest slot-boundp.5
35
(let ((obj (make-instance 'slot-boundp-class-01)))
36
(slot-makunbound obj 'c)
40
;;; Argument order test(s)
42
(deftest slot-boundp.order.1
43
(let ((obj (make-instance 'slot-boundp-class-01))
46
(slot-boundp (progn (setf x (incf i)) obj)
47
(progn (setf y (incf i)) 'a))
53
(deftest slot-boundp.error.1
54
(signals-error (slot-boundp) program-error)
57
(deftest slot-boundp.error.2
58
(signals-error (let ((obj (make-instance 'slot-boundp-class-01)))
63
(deftest slot-boundp.error.3
64
(signals-error (let ((obj (make-instance 'slot-boundp-class-01)))
65
(slot-boundp obj 'a nil))
69
(deftest slot-boundp.error.4
71
(let ((obj (make-instance 'slot-boundp-class-01)))
72
(slot-boundp obj 'nonexistent-slot))
76
;;; SLOT-BOUNDP should signal an error on elements of built-in-classes
77
(deftest slot-boundp.error.5
78
(let ((built-in-class (find-class 'built-in-class)))
79
(loop for e in *mini-universe*
80
for class = (class-of e)
81
when (and (eq (class-of class) built-in-class)
82
(handler-case (progn (slot-boundp e 'foo) t)