finish-output.lsp 1.26 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:38:20 2004
;;;; Contains: Tests of FINISH-OUTPUT

(in-package :cl-test)

(deftest finish-output.1
  (finish-output)
  nil)

(deftest finish-output.2
  (finish-output t)
  nil)

(deftest finish-output.3
  (finish-output nil)
  nil)

(deftest finish-output.4
  (loop for s in (list *debug-io* *error-output* *query-io*
sds's avatar
sds committed
22 23 24 25
                       *standard-output* *trace-output* *terminal-io*)
        for results = (multiple-value-list (finish-output s))
        unless (equal results '(nil))
        collect s)
26 27
  nil)

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

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

40 41 42 43 44 45 46 47 48 49 50
;;; Error tests

(deftest finish-output.error.1
  (signals-error (finish-output nil nil) program-error)
  t)

(deftest finish-output.error.2
  (signals-error (finish-output t nil) program-error)
  t)

(deftest finish-output.error.3
51
  (check-type-error #'finish-output
sds's avatar
sds committed
52
                    #'(lambda (x) (typep x '(or stream (member nil t)))))
53
  nil)
54