clear-output.lsp 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
;-*- 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*
sds's avatar
sds committed
22 23 24 25 26
                       *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)
27 28
  nil)

29 30
(deftest clear-output.5
  (let ((os (make-string-output-stream)))
pfdietz's avatar
pfdietz committed
31
    (let ((*terminal-io* (make-two-way-stream (make-string-input-stream "")
sds's avatar
sds committed
32
                                              os)))
33 34 35 36 37 38 39 40
      (clear-output t)))
  nil)

(deftest clear-output.6
  (let ((*standard-output* (make-string-output-stream)))
    (clear-output nil))
  nil)

41 42 43 44 45 46 47 48 49 50 51
;;; 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
52
  (check-type-error #'clear-output #'(lambda (x) (typep x '(or stream (member nil t)))))
53
  nil)