2
;;;; Author: Paul Dietz
3
;;;; Created: Sat May 10 14:39:01 2003
4
;;;; Contains: Tests for SLOT-MAKUNBOUND
8
;;; This function is heavily tested in other files as well
10
(defclass slot-makunbound-class-01 ()
12
(b :allocation :instance)
13
(c :allocation :class)
18
(deftest slot-makunbound.1
19
(loop for slot-name in '(a b c d e)
21
(let ((obj (allocate-instance (find-class 'slot-makunbound-class-01))))
23
(equalt (multiple-value-list (slot-makunbound obj slot-name))
25
(not (slot-boundp obj slot-name))))
29
(deftest slot-makunbound.2
30
(loop for slot-name in '(a b c d e)
31
for slot-value in '(t t t 10 t '(a))
33
(let ((obj (allocate-instance (find-class 'slot-makunbound-class-01))))
34
(setf (slot-value obj slot-name) slot-value)
36
(equalt (multiple-value-list (slot-makunbound obj slot-name))
38
(not (slot-boundp obj slot-name))))
42
;;; Order of evaluation test(s)
44
(deftest slot-makunbound.order.1
45
(let ((obj (make-instance 'slot-makunbound-class-01))
48
(eqt (slot-makunbound (progn (setf x (incf i)) obj)
49
(progn (setf y (incf i)) 'a))
54
(deftest slot-makunbound.order.2
55
(let ((obj (make-instance 'slot-makunbound-class-01))
57
(setf (slot-value obj 'a) t)
59
(eqt (slot-makunbound (progn (setf x (incf i)) obj)
60
(progn (setf y (incf i)) 'a))
67
(deftest slot-makunbound.error.1
68
(signals-error (slot-makunbound) program-error)
71
(deftest slot-makunbound.error.2
72
(signals-error (slot-makunbound (make-instance 'slot-makunbound-class-01))
76
(deftest slot-makunbound.error.3
77
(signals-error (slot-makunbound (make-instance 'slot-makunbound-class-01)
82
(deftest slot-makunbound.error.4
83
(let ((built-in-class (find-class 'built-in-class)))
84
(loop for e in *mini-universe*
85
for class = (class-of e)
86
when (and (eq (class-of class) built-in-class)
87
(handler-case (progn (slot-makunbound e 'foo) t)