5 |
|
|
6 |
(in-package :cl-test) |
(in-package :cl-test) |
7 |
|
|
8 |
(defclass slot-missing-class-01 () |
(defparameter *slot-missing-class-01-var* nil) |
9 |
(a b c)) |
|
10 |
|
(defclass slot-missing-class-01 () (a b c)) |
11 |
|
|
12 |
(defmethod slot-missing ((class t) (obj slot-missing-class-01) |
(defmethod slot-missing ((class t) (obj slot-missing-class-01) |
13 |
(slot-name t) (operation t) |
(slot-name t) (operation t) |
14 |
&optional (new-value nil new-value-p)) |
&optional (new-value nil new-value-p)) |
15 |
(list slot-name operation new-value (notnot new-value-p))) |
(setf *slot-missing-class-01-var* |
16 |
|
(list slot-name operation new-value (notnot new-value-p)))) |
17 |
|
|
18 |
(deftest slot-missing.1 |
(deftest slot-missing.1 |
19 |
(let ((obj (make-instance 'slot-missing-class-01))) |
(let ((obj (make-instance 'slot-missing-class-01))) |
20 |
(slot-value obj 'foo)) |
(values |
21 |
|
(slot-value obj 'foo) |
22 |
|
*slot-missing-class-01-var*)) |
23 |
|
(foo slot-value nil nil) |
24 |
(foo slot-value nil nil)) |
(foo slot-value nil nil)) |
25 |
|
|
26 |
(deftest slot-missing.2 |
(deftest slot-missing.2 |
27 |
(let ((obj (make-instance 'slot-missing-class-01))) |
(let ((obj (make-instance 'slot-missing-class-01))) |
28 |
(setf (slot-value obj 'foo) 'bar)) |
(values |
29 |
|
(setf (slot-value obj 'foo) 'bar) |
30 |
|
*slot-missing-class-01-var*)) |
31 |
|
bar |
32 |
(foo setf bar t)) |
(foo setf bar t)) |
33 |
|
|
34 |
(deftest slot-missing.3 |
(deftest slot-missing.3 |
35 |
(let ((obj (make-instance 'slot-missing-class-01))) |
(let ((obj (make-instance 'slot-missing-class-01))) |
36 |
(slot-makunbound obj 'xyz)) |
(values |
37 |
|
(eqt obj (slot-makunbound obj 'xyz)) |
38 |
|
*slot-missing-class-01-var*)) |
39 |
|
t |
40 |
(xyz slot-makunbound nil nil)) |
(xyz slot-makunbound nil nil)) |
41 |
|
|
42 |
(deftest slot-missing.4 |
(deftest slot-missing.4 |
43 |
(let ((obj (make-instance 'slot-missing-class-01))) |
(let ((obj (make-instance 'slot-missing-class-01))) |
44 |
(slot-boundp obj 'abc)) |
(values |
45 |
|
(notnot (slot-boundp obj 'abc)) |
46 |
|
*slot-missing-class-01-var*)) |
47 |
|
t |
48 |
(abc slot-boundp nil nil)) |
(abc slot-boundp nil nil)) |
49 |
|
|
50 |
(deftest slot-missing.5 |
(deftest slot-missing.5 |
76 |
(let* ((obj (make-instance 'slot-missing-class-01))) |
(let* ((obj (make-instance 'slot-missing-class-01))) |
77 |
(slot-boundp obj 'not-there)) |
(slot-boundp obj 'not-there)) |
78 |
nil) |
nil) |
|
|
|
|
|
|
|
|
|
|
|
|