source: trunk/source/tests/ansi-tests/cerror.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Feb 15 19:45:27 2003
4;;;; Contains: Tests of CERROR
5
6
7(in-package :cl-test)
8
9(deftest cerror.1
10  (let ((fmt "Cerror"))
11    (handler-case (cerror "Keep going." fmt)
12                  (simple-error (c) (frob-simple-error c fmt))))
13  t)
14
15(deftest cerror.2
16  (let* ((fmt "Cerror")
17         (cnd (make-condition 'simple-error :format-control fmt)))
18    (handler-case (cerror "Continue on." cnd)
19                  (simple-error (c) (frob-simple-error c fmt))))
20  t)
21
22(deftest cerror.2a
23  (let* ((fmt (formatter "Cerror"))
24         (cnd (make-condition 'simple-error :format-control fmt)))
25    (handler-case (cerror "Continue on." cnd)
26                  (simple-error (c) (frob-simple-error c fmt))))
27  t)
28
29(deftest cerror.3
30  (let ((fmt "Cerror"))
31    (handler-case (cerror "Continue" 'simple-error :format-control fmt)
32                  (simple-error (c) (frob-simple-error c fmt))))
33  t)
34
35(deftest cerror.4
36  (let ((fmt "Cerror: ~A"))
37    (handler-case (cerror "On on" fmt 10)
38                  (simple-error (c) (frob-simple-error c fmt 10))))
39  t)
40
41(deftest cerror.4a
42  (let ((fmt (formatter "Cerror: ~A")))
43    (handler-case (cerror "On on" fmt 10)
44                  (simple-error (c) (frob-simple-error c fmt 10))))
45  t)
46
47(deftest cerror.5
48  (let ((fmt (formatter "Cerror")))
49    (handler-case (cerror "Keep going." fmt)
50                  (simple-error (c) (frob-simple-error c fmt))))
51  t)
52
53;;; Continuing from a cerror
54
55(deftest cerror.6
56  (handler-bind ((simple-error #'(lambda (c) (continue c))))
57                (progn
58                  (cerror "Wooo" 'simple-error)
59                  10))
60  10)
61
62;;; Program error cases
63
64(deftest cerror.error.1
65  (signals-error (cerror) program-error)
66  t)
67
68(deftest cerror.error.2
69  (signals-error (cerror "foo") program-error)
70  t)
71
Note: See TracBrowser for help on using the repository browser.