cell-error-name.lsp 1.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Jan 27 22:36:48 2003
;;;; Contains: Tests of CELL-ERROR-NAME

(in-package :cl-test)

(deftest cell-error-name.1
  (handler-case
   (eval 'my-unbound-variable)
   (cell-error (c) (cell-error-name c)))
  my-unbound-variable)

(deftest cell-error-name.2
  (handler-case
   (eval '(my-undefined-function))
17
   ;; (warning (c) (muffle-warning c))
18 19 20 21 22 23
   (cell-error (c) (cell-error-name c)))
  my-undefined-function)

(deftest cell-error-name.3
  (cell-error-name (make-condition 'unbound-variable :name 'x))
  x)
sds's avatar
sds committed
24

25 26 27
(deftest cell-error-name.4
  (cell-error-name (make-condition 'undefined-function :name 'f))
  f)
sds's avatar
sds committed
28

29 30 31
(deftest cell-error-name.5
  (cell-error-name (make-condition 'unbound-slot :name 's))
  s)
32 33 34 35 36

(deftest cell-error-name.6
  (let ((i 0))
    (values
     (cell-error-name (progn (incf i) (make-condition
sds's avatar
sds committed
37
                                       'unbound-slot :name 's)))
38 39 40
     i))
  s 1)

sds's avatar
sds committed
41

42 43 44 45
;;; Need test raising condition unbound-slot


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

(deftest cell-error-name.error.2
50
  (signals-error (cell-error-name (make-condition 'unbound-variable :name 'foo) nil)
sds's avatar
sds committed
51
                 program-error)
52
  t)