Skip to content
Snippets Groups Projects
Commit 812e8af0 authored by pfdietz's avatar pfdietz
Browse files

Tests for warnings.

parent 2fff2c54
No related branches found
No related tags found
No related merge requests found
......@@ -40,3 +40,27 @@
(error fmt)
(simple-error (c) (frob-simple-error c fmt))))
t)
(deftest error.6
(handler-case
(error 'simple-condition)
(error (c) :wrong)
(simple-condition (c) :right))
:right)
(deftest error.7
(handler-case
(error 'simple-warning)
(error (c) :wrong)
(simple-warning (c) :right)
(condition (c) :wrong2))
:right)
(deftest error.8
(let ((fmt "Boo!"))
(handler-case
(error 'simple-warning :format-control fmt)
(simple-warning (c) (frob-simple-warning c fmt))))
t)
;;; Tests for other conditions will in their own files.
......@@ -5,3 +5,5 @@
(load "error.lsp")
(load "cerror.lsp")
(load "check-type.lsp")
(load "warn.lsp")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Feb 23 20:48:12 2003
;;;; Contains: Tests for WARN
(in-package :cl-test)
(deftest warn.1
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn "This is a warning"))
warned)))
(nil) t)
(deftest warn.2
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning))))
(values
(multiple-value-list (warn "This is a warning"))
warned)))
(nil) t)
(deftest warn.3
(with-output-to-string
(*error-output*)
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(warn "Foo!"))))
"")
(deftest warn.4
(let ((str (with-output-to-string
(*error-output*)
(warn "Foo!"))))
(not (string= str "")))
t)
(deftest warn.5
(let ((warned nil))
(handler-bind
((simple-warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn "This is a warning"))
warned)))
(nil) t)
(deftest warn.6
(let ((warned nil))
(handler-bind
((simple-condition #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn "This is a warning"))
warned)))
(nil) t)
(deftest warn.7
(let ((warned nil))
(handler-bind
((condition #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn "This is a warning"))
warned)))
(nil) t)
(deftest warn.8
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn 'simple-warning :format-control "Foo!"))
warned)))
(nil) t)
(deftest warn.9
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn 'warning))
warned)))
(nil) t)
(deftest warn.10
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'simple-warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn (make-condition 'simple-warning :format-control "Foo!")))
warned)))
(nil) t)
(deftest warn.11
(let ((warned nil))
(handler-bind
((warning #'(lambda (c)
(assert (typep c 'warning))
(setf warned t)
(muffle-warning c))))
(values
(multiple-value-list (warn (make-condition 'warning)))
warned)))
(nil) t)
(deftest warn.12
(classify-error (warn 'condition))
type-error)
(deftest warn.13
(classify-error (warn 'simple-condition))
type-error)
(deftest warn.14
(classify-error (warn (make-condition 'simple-warning) :format-control "Foo"))
type-error)
(deftest warn.15
(classify-error (warn))
program-error)
(deftest warn.16
(classify-error (warn (make-condition 'condition)))
type-error)
(deftest warn.17
(classify-error (warn (make-condition 'simple-condition)))
type-error)
(deftest warn.18
(classify-error (warn (make-condition 'simple-error)))
type-error)
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