File: make-condition.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (52 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Thu Jun 23 11:54:10 2005
;;;; Contains: Tests of MAKE-CONDITION

(in-package :cl-test)


(deftest make-condition.1
  (loop for tp in *cl-condition-type-symbols*
	for c = (make-condition tp)
	unless (and (typep c tp)
		    (typep c 'condition))
	collect (list tp c))
  nil)

(deftest make-condition.2
  (loop for tp in *cl-condition-type-symbols*
	for class = (find-class tp)
	for c = (and class (make-condition class))
	unless (or (not class)
		   (and (typep c tp)
			(typep c class)
			(typep c 'condition)))
	collect (list tp c))
  nil)

(deftest make-condition.3
  :notes (:make-condition-with-compound-name :ansi-spec-problem)
  (let* ((tp '(or program-error type-error))
	 (c (make-condition tp)))
    (or (not (and (subtypep tp 'condition)
		  (or (subtypep 'program-error tp)
		      (subtypep 'type-error tp))))
	(notnot-mv (typep c tp))))
  t)

(deftest make-condition.4
  :notes (:make-condition-with-compound-name :ansi-spec-problem)
  (let* ((tp '(and simple-error type-error))
	 (c (make-condition tp)))
    (or (not (and (subtypep 'simple-error tp)
		  (subtypep 'type-error tp)
		  (subtypep tp 'condition)))
	(notnot-mv (typep c tp))))
  t)

;;; Error tests

(deftest make-condition.error.1
  (signals-error (make-condition) program-error)
  t)