-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcerror.lsp
71 lines (56 loc) · 1.8 KB
/
cerror.lsp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sat Feb 15 19:45:27 2003
;;;; Contains: Tests of CERROR
(in-package :cl-test)
(deftest cerror.1
(let ((fmt "Cerror"))
(handler-case (cerror "Keep going." fmt)
(simple-error (c) (frob-simple-error c fmt))))
t)
(deftest cerror.2
(let* ((fmt "Cerror")
(cnd (make-condition 'simple-error :format-control fmt)))
(handler-case (cerror "Continue on." cnd)
(simple-error (c) (frob-simple-error c fmt))))
t)
(deftest cerror.2a
(let* ((fmt (formatter "Cerror"))
(cnd (make-condition 'simple-error :format-control fmt)))
(handler-case (cerror "Continue on." cnd)
(simple-error (c) (frob-simple-error c fmt))))
t)
(deftest cerror.3
(let ((fmt "Cerror"))
(handler-case (cerror "Continue" 'simple-error :format-control fmt)
(simple-error (c) (frob-simple-error c fmt))))
t)
(deftest cerror.4
(let ((fmt "Cerror: ~A"))
(handler-case (cerror "On on" fmt 10)
(simple-error (c) (frob-simple-error c fmt 10))))
t)
(deftest cerror.4a
(let ((fmt (formatter "Cerror: ~A")))
(handler-case (cerror "On on" fmt 10)
(simple-error (c) (frob-simple-error c fmt 10))))
t)
(deftest cerror.5
(let ((fmt (formatter "Cerror")))
(handler-case (cerror "Keep going." fmt)
(simple-error (c) (frob-simple-error c fmt))))
t)
;;; Continuing from a cerror
(deftest cerror.6
(handler-bind ((simple-error #'(lambda (c) (continue c))))
(progn
(cerror "Wooo" 'simple-error)
10))
10)
;;; Program error cases
(deftest cerror.error.1
(signals-error (cerror) program-error)
t)
(deftest cerror.error.2
(signals-error (cerror "foo") program-error)
t)