class-name.lsp 1.13 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jun 15 12:05:47 2003
;;;; Contains: Tests of CLASS-NAME

(in-package :cl-test)

;;; This is mostly tested elsewhere.

(deftest class-name.1
  (class-name (find-class 'symbol))
  symbol)

(defclass class-name-class-01 () (a b c))

pfdietz's avatar
pfdietz committed
16
17
(report-and-ignore-errors
 (eval '(defmethod class-name ((x class-name-class-01)) 'silly)))
18
19
20
21
22
23
24
25
26
27
28

(deftest class-name.2
  (class-name (make-instance 'class-name-class-01))
  silly)

;; Tests of (setf class-name)

(deftest setf-class-name.1
  (typep* #'(setf class-name) 'standard-generic-function)
  t)

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(deftest setf-class-name.2
  (let ((sym (gensym))
	(newsym (gensym)))
    (eval `(defclass ,sym () (a b c)))
    (let ((class (find-class sym)))
      (values
       (eqlt (class-name class) sym)
       (equalt
	(multiple-value-list (setf (class-name (find-class sym)) newsym))
	(list newsym))
       (eqlt newsym (class-name class)))))
  t t t)
     

;;; Error tests

45
(deftest class-name.error.1
46
47
  (signals-error (class-name) program-error)
  t)
48
49

(deftest class-name.error.2
50
51
52
  (signals-error (class-name (find-class 'symbol) nil)
		 program-error)
  t)