forked from robert-strandh/ansi-cl-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclear-output.lsp
53 lines (42 loc) · 1.33 KB
/
clear-output.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
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Wed Jan 28 06:43:17 2004
;;;; Contains: Tests of CLEAR-OUTPUT
(in-package :cl-test)
(deftest clear-output.1
(progn (finish-output) (clear-output))
nil)
(deftest clear-output.2
(progn (finish-output) (clear-output t))
nil)
(deftest clear-output.3
(progn (finish-output) (clear-output nil))
nil)
(deftest clear-output.4
(loop for s in (list *debug-io* *error-output* *query-io*
*standard-output* *trace-output* *terminal-io*)
for dummy = (finish-output s)
for results = (multiple-value-list (clear-output s))
unless (equal results '(nil))
collect s)
nil)
(deftest clear-output.5
(let ((os (make-string-output-stream)))
(let ((*terminal-io* (make-two-way-stream (make-string-input-stream "")
os)))
(clear-output t)))
nil)
(deftest clear-output.6
(let ((*standard-output* (make-string-output-stream)))
(clear-output nil))
nil)
;;; Error tests
(deftest clear-output.error.1
(signals-error (clear-output nil nil) program-error)
t)
(deftest clear-output.error.2
(signals-error (clear-output t nil) program-error)
t)
(deftest clear-output.error.3
(check-type-error #'clear-output #'(lambda (x) (typep x '(or stream (member nil t)))))
nil)