Commit a732c76a authored by pfdietz's avatar pfdietz

Begin executing class tests as part of the whole test process. Add tests for...

Begin executing class tests as part of the whole test process.  Add tests for defclass with forward referencing.
parent b2af4d89
......@@ -192,11 +192,11 @@
when (slot-boundp instance slot)
collect (list 'is-bound slot))
(loop for slot in slot-names
(unless (equal (multiple-value-list
unless (equal (multiple-value-list
(notnot-mv (slot-exists-p instance slot)))
'(t))
(list 'does-not-exist slot)))
(let ((bad-slot #:foo))
collect (list 'does-not-exist slot))
(let ((bad-slot '#:foo))
(when (slot-exists-p instance bad-slot)
(list (list 'should-not-exist bad-slot))))
)))
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Wed Apr 2 22:53:27 2003
;;;; Contains: Tests for definitions of classes with forward references
(in-package :cl-test)
(deftest defclass.forward-ref.1
(let ((c1 (gensym))
(c2 (gensym)))
(let ((class1 (eval `(defclass ,c1 (,c2) nil))))
(if (not (typep class1 'class))
1
(let ((class2 (eval `(defclass ,c2 nil nil))))
(if (not (typep class2 'class))
2
(let ((i1 (make-instance c1))
(i2 (make-instance c2)))
(cond
((not (typep i1 c1)) 3)
((not (typep i1 class1)) 4)
((not (typep i1 c2)) 5)
((not (typep i1 class2)) 6)
((typep i2 c1) 7)
((typep i2 class1) 8)
((not (typep i2 c2)) 9)
((not (typep i2 class2)) 10)
(t 'good))))))))
good)
(deftest defclass.forward-ref.2
(let ((c1 (gensym))
(c2 (gensym))
(c3 (gensym)))
(let ((class1 (eval `(defclass ,c1 (,c2 ,c3) nil))))
(if (not (typep class1 'class))
1
(let ((class2 (eval `(defclass ,c2 nil nil))))
(if (not (typep class2 'class))
2
(let ((class3 (eval `(defclass ,c3 nil nil))))
(if (not (typep class3 'class))
3
(let ((i1 (make-instance c1))
(i2 (make-instance c2))
(i3 (make-instance c3)))
(cond
((not (typep i1 c1)) 4)
((not (typep i1 class1)) 5)
((not (typep i1 c2)) 6)
((not (typep i1 class2)) 7)
((not (typep i1 c3)) 8)
((not (typep i1 class3)) 9)
((typep i2 c1) 10)
((typep i2 class1) 11)
((typep i3 c1) 12)
((typep i3 class1) 13)
((not (typep i2 c2)) 14)
((not (typep i2 class2)) 15)
((not (typep i3 c3)) 16)
((not (typep i3 class3)) 17)
((typep i2 c3) 18)
((typep i2 class3) 19)
((typep i3 c2) 20)
((typep i3 class2) 21)
(t 'good))))))))))
good)
(deftest defclass.forward-ref.3
(let ((c1 (gensym))
(c2 (gensym))
(c3 (gensym)))
(let ((class1 (eval `(defclass ,c1 (,c2) nil))))
(if (not (typep class1 'class))
1
(let ((class2 (eval `(defclass ,c2 (,c3) nil))))
(if (not (typep class2 'class))
2
(let ((class3 (eval `(defclass ,c3 nil nil))))
(if (not (typep class3 'class))
3
(let ((i1 (make-instance c1))
(i2 (make-instance c2))
(i3 (make-instance c3)))
(cond
((not (typep i1 c1)) 4)
((not (typep i1 class1)) 5)
((not (typep i1 c2)) 6)
((not (typep i1 class2)) 7)
((not (typep i1 c3)) 8)
((not (typep i1 class3)) 9)
((typep i2 c1) 10)
((typep i2 class1) 11)
((typep i3 c1) 12)
((typep i3 class1) 13)
((not (typep i2 c2)) 14)
((not (typep i2 class2)) 15)
((not (typep i3 c3)) 16)
((not (typep i3 class3)) 17)
((not (typep i2 c3)) 18)
((not (typep i2 class3)) 19)
((typep i3 c2) 20)
((typep i3 class2) 21)
(t 'good))))))))))
good)
......@@ -58,10 +58,12 @@
program-error)
(deftest defclass.error.9
(classify-error
(defclass defclass-error-9 ()
(foo bar)
(#:unknown-class-option nil)))
(let ((option (gentemp "UNKNOWN-OPTION" (symbol-package :foo))))
(eval
`(classify-error
(defclass defclass-error-9 ()
(foo bar)
(,option nil)))))
program-error)
......
......@@ -12,6 +12,9 @@
;;; Tests of iteration forms
(load "load-iteration.lsp")
;;; Tests of objects
(load "load-objects.lsp")
;;; Tests of conditions
(load "load-conditions.lsp")
......
......@@ -5,6 +5,7 @@
(compile-and-load "defclass-aux.lsp")
(load "defclass.lsp")
(load "defclass-forward-reference.lsp")
(load "ensure-generic-function.lsp")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment