Skip to content
Snippets Groups Projects
Commit 68c204ce authored by pfdietz's avatar pfdietz
Browse files

Changed apply.6 to apply.order.1. Added more error, cerror tests.

parent 202b1736
No related branches found
No related tags found
No related merge requests found
...@@ -43,12 +43,15 @@ ...@@ -43,12 +43,15 @@
(apply 'cons '(a b)) (apply 'cons '(a b))
(a . b)) (a . b))
(deftest apply.6 (deftest apply.order.1
(let ((x 0) y z) (let ((i 0) x y z)
(values (values
(apply (progn (setf y (incf x)) (apply (progn (setf x (incf i))
#'identity) #'list)
(progn (setf z (incf x)) (progn (setf y (incf i))
'b)
(progn (setf z (incf i))
(list 'a))) (list 'a)))
x y z)) i x y z))
a 2 1 2) (b a) 3 1 2 3)
;-*- 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)
(and
(null (simple-condition-format-arguments c))
(eqt (simple-condition-format-control 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)
(and (eqt c cnd)
(eqt (simple-condition-format-control c)
fmt)))))
t)
(deftest cerror.3
(let ((fmt "Cerror"))
(handler-case (cerror "Continue" 'simple-error :format-control fmt)
(simple-error (c)
(eqt (simple-condition-format-control c)
fmt))))
t)
(deftest cerror.4
(let ((fmt "Cerror: ~A"))
(handler-case (cerror "On on" fmt 10)
(simple-error (c)
(and
(equalt
(simple-condition-format-arguments c)
'(10))
(eqt (simple-condition-format-control c)
fmt)))))
t)
(deftest cerror.5
(let ((fmt (formatter "Cerror")))
(handler-case (cerror "Keep going." fmt)
(simple-error (c)
(and
(null (simple-condition-format-arguments c))
(eqt (simple-condition-format-control 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)
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
(let ((fmt "Error")) (let ((fmt "Error"))
(handler-case (error fmt) (handler-case (error fmt)
(simple-error (c) (simple-error (c)
(eqt (simple-condition-format-control c) (and
fmt)))) (null (simple-condition-format-arguments c))
(eqt (simple-condition-format-control c)
fmt)))))
t) t)
(deftest error.2 (deftest error.2
...@@ -31,5 +33,26 @@ ...@@ -31,5 +33,26 @@
fmt)))) fmt))))
t) t)
(deftest error.4
(let ((fmt "Error: ~A"))
(handler-case (error fmt 10)
(simple-error (c)
(and
(equalt
(simple-condition-format-arguments c)
'(10))
(eqt (simple-condition-format-control c)
fmt)))))
t)
(deftest error.5
(let ((fmt (formatter "Error")))
(handler-case (error fmt)
(simple-error (c)
(and
(null (simple-condition-format-arguments c))
(eqt (simple-condition-format-control c)
fmt)))))
t)
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
(load "cell-error-name.lsp") (load "cell-error-name.lsp")
(load "assert.lsp") (load "assert.lsp")
(load "error.lsp") (load "error.lsp")
(load "cerror.lsp")
;;; Tests of conses ;;; Tests of conses
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment