unbound-slot.lsp 797 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Jun  4 20:14:26 2003
;;;; Contains: Tests for UNBOUND-SLOT, UNBOUND-SLOT-INSTANCE

(in-package :cl-test)

(defclass ubs-class-01 ()
  ((a :initarg :a)))

(deftest unbound-slot.1
  (let ((obj (make-instance 'ubs-class-01)))
    (handler-case
     (slot-value obj 'a)
     (unbound-slot (c)
		   (values
		    (typep* c 'cell-error)
		    (eqt (unbound-slot-instance c) obj)
		    (cell-error-name c)))))
  t t a)

(defclass ubs-class-02 ()
  ((b :allocation :class)))

(deftest unbound-slot.2
  (let ((obj (make-instance 'ubs-class-02)))
    (handler-case
     (slot-value obj 'b)
     (unbound-slot (c)
		   (values
		    (typep* c 'cell-error)
		    (eqt (unbound-slot-instance c) obj)
		    (cell-error-name c)))))
  t t b)