/[gcl]/gcl/ansi-tests/slot-exists-p.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/slot-exists-p.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pfdietz, Sat May 10 14:48:15 2003 UTC revision 1.2 by pfdietz, Sat May 10 15:41:35 2003 UTC
# Line 53  Line 53 
53            when (slot-exists-p x slot-name)            when (slot-exists-p x slot-name)
54            collect x))            collect x))
55    nil)    nil)
56    
57    ;;; With various types
58    
59    (defclass slot-exists-p-class-02 ()
60      ((a :type t) (b :type nil) (c :type symbol) (d :type cons)
61       (e :type float) (f :type single-float) (g :type short-float)
62       (h :type double-float) (i :type long-float) (j :type char)
63       (k :type base-char) (l :type rational) (m :type ratio) (n :type integer)
64       (o :type fixnum) (p :type complex) (q :type condition)))
65    
66    (deftest slot-exists-p.9
67      (let ((obj (allocate-instance (find-class 'slot-exists-p-class-02))))
68        (map-slot-exists-p* obj '(a b c d e f g h i j k l m n o p q)))
69      (t t t t t t t t t t t t t t t t t))
70    
71    ;;; Inheritance
72    
73    (defclass slot-exists-p-class-03a ()
74      (a b))
75    
76    (defclass slot-exists-p-class-03b ()
77      (a c))
78    
79    (defclass slot-exists-p-class-03c (slot-exists-p-class-03a slot-exists-p-class-03b)
80      (d e))
81    
82    (deftest slot-exists-p.10
83      (let ((obj (allocate-instance (find-class 'slot-exists-p-class-03c))))
84        (map-slot-exists-p* obj '(a b c d e f g)))
85      (t t t t t nil nil))
86    
87    ;;; SLOT-EXISTS-P is supposed to work on structure objects and condition objects
88    
89    (defstruct slot-exists-p-struct-01
90      a b c)
91    
92    (deftest slot-exists-p.11
93      (let ((obj (make-slot-exists-p-struct-01)))
94        (map-slot-exists-p* obj '(a b c z nil)))
95      (t t t nil nil))
96    
97    (deftest slot-exists-p.12
98      (let ((obj (make-slot-exists-p-struct-01 :a 1 :b 2 :c 3)))
99        (map-slot-exists-p* obj '(a b c z nil)))
100      (t t t nil nil))
101    
102    (defstruct (slot-exists-p-struct-02 (:include slot-exists-p-struct-01))
103      d e)
104        
105    (deftest slot-exists-p.13
106      (let ((obj (make-slot-exists-p-struct-02)))
107        (map-slot-exists-p* obj '(a b c d e f z nil)))
108      (t t t t t nil nil nil))
109    
110    (deftest slot-exists-p.14
111      (let ((obj (make-slot-exists-p-struct-02 :a 1 :b 3 :e 5)))
112        (map-slot-exists-p* obj '(a b c d e f z nil)))
113      (t t t t t nil nil nil))
114    
115      
116    ;;; SLOT-EXISTS-P is supposed to work on condition objects, too
117    ;;; (after all, they are objects, and they have slots)
118    
119    (define-condition slot-exists-p-condition-01 ()
120      (a b c))
121    
122    (deftest slot-exists-p.15
123      (let ((obj (make-condition 'slot-exists-p-condition-01)))
124        (map-slot-exists-p* obj (list 'a 'b 'c (gensym))))
125      (t t t nil))
126    
127    (define-condition slot-exists-p-condition-02 (slot-exists-p-condition-01)
128      (a d e))
129    
130    (deftest slot-exists-p.16
131      (let ((obj (make-condition 'slot-exists-p-condition-01)))
132        (map-slot-exists-p* obj (list 'a 'b 'c 'd 'e (gensym))))
133      (t t t t t nil))
134    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26