source: trunk/source/tests/ansi-tests/slot-unbound.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Jun 15 06:57:23 2003
4;;;; Contains: Tests for SLOT-UNBOUND
5
6(in-package :cl-test)
7
8(defclass slot-unbound-class-01 ()
9  ((a :reader sunb-a)
10   (b :accessor sunb-b)
11   (c :writer sunb-c)
12   (e :reader sunb-e)
13   (f :reader sunb-f)))
14
15(defmethod slot-unbound ((class t) (obj slot-unbound-class-01) (slot-name t))
16  (list (class-name class) slot-name))
17
18(deftest slot-unbound.1
19  (let ((obj (make-instance 'slot-unbound-class-01)))
20    (values
21     (slot-value obj 'a)
22     (slot-value obj 'b)
23     (slot-value obj 'c)))
24  (slot-unbound-class-01 a)
25  (slot-unbound-class-01 b)
26  (slot-unbound-class-01 c))
27
28(deftest slot-unbound.2
29  (let ((obj (make-instance 'slot-unbound-class-01)))
30    (values
31     (sunb-a obj)
32     (sunb-b obj)))
33  (slot-unbound-class-01 a)
34  (slot-unbound-class-01 b))
35
36(defmethod slot-unbound ((class t) (obj slot-unbound-class-01)
37                         (slot-name (eql 'e)))
38  (values))
39
40(defmethod slot-unbound ((class t) (obj slot-unbound-class-01)
41                         (slot-name (eql 'f)))
42  (values 1 2 3))
43
44(deftest slot-unbound.3
45  (slot-value (make-instance 'slot-unbound-class-01) 'e)
46  nil)
47
48(deftest slot-unbound.4
49  (slot-value (make-instance 'slot-unbound-class-01) 'f)
50  1)
51
52(deftest slot-unbound.5
53  (sunb-e (make-instance 'slot-unbound-class-01))
54  nil)
55
56(deftest slot-unbound.6
57  (sunb-f (make-instance 'slot-unbound-class-01))
58  1)
Note: See TracBrowser for help on using the repository browser.