unbound-slot.lsp 909 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
;-*- 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)
sds's avatar
sds committed
16
17
18
19
                   (values
                    (typep* c 'cell-error)
                    (eqt (unbound-slot-instance c) obj)
                    (cell-error-name c)))))
20
21
22
23
24
25
26
27
28
29
  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)
sds's avatar
sds committed
30
31
32
33
                   (values
                    (typep* c 'cell-error)
                    (eqt (unbound-slot-instance c) obj)
                    (cell-error-name c)))))
34
35
36
  t t b)