muffle-warning.lsp 1.26 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 Mar 23 08:46:05 2003
;;;; Contains: Tests of the MUFFLE-WARNING restart and function

(in-package :cl-test)

(deftest muffle-warning.1
  (restart-case
   (progn (muffle-warning) 'bad)
   (muffle-warning () 'good))
  good)

(deftest muffle-warning.2
  (let ((c1 (make-condition 'error))
sds's avatar
sds committed
16
        (c2 (make-condition 'error)))
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    (restart-case
     (with-condition-restarts
      c1
      (list (first (compute-restarts)))
      (muffle-warning c2))
     (muffle-warning () 'bad)
     (muffle-warning () 'good)))
  good)

(deftest muffle-warning.3
  (restart-case
   (progn (muffle-warning nil) 'bad)
   (muffle-warning () 'good))
  good)

(deftest muffle-warning.4
  (let ((c1 (make-condition 'error))
sds's avatar
sds committed
34
        (c2 (make-condition 'error)))
35 36 37 38 39 40 41 42 43 44
    (restart-case
     (with-condition-restarts
      c1
      (list (first (compute-restarts)))
      (muffle-warning nil))
     (muffle-warning () 'good)
     (muffle-warning () 'bad)))
  good)

(deftest muffle-warning.5
45
  (signals-error
46
   (let ((c1 (make-condition 'error))
sds's avatar
sds committed
47
         (c2 (make-condition 'error)))
48 49 50 51
     (with-condition-restarts
      c1
      (compute-restarts)
      ;; All conditions are now associated with c1
52 53 54 55
      (muffle-warning c2)))
   control-error)
  t)