output-stream-p.lsp 936 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Jan 13 19:46:12 2004
;;;; Contains: Tests of OUTPUT-STREAM-P

(in-package :cl-test)

(deftest output-stream-p.1
  (notnot-mv (output-stream-p *standard-output*))
  t)

(deftest output-stream-p.2
  (notnot-mv (output-stream-p *terminal-io*))
  t)

(deftest output-stream-p.3
  (with-open-file (s "output-stream-p.lsp" :direction :input)
sds's avatar
sds committed
18
                  (output-stream-p s))
19 20 21 22
  nil)

(deftest output-stream-p.4
  (with-open-file (s "foo.txt" :direction :output
sds's avatar
sds committed
23 24
                     :if-exists :supersede)
                  (notnot-mv (output-stream-p s)))
25 26 27 28 29
  t)

;;; Error tests

(deftest output-stream-p.error.1
30 31
  (signals-error (output-stream-p) program-error)
  t)
32 33

(deftest output-stream-p.error.2
34 35
  (signals-error (output-stream-p *standard-output* nil) program-error)
  t)
36 37

(deftest output-stream-p.error.3
pfdietz's avatar
pfdietz committed
38
  (check-type-error #'output-stream-p #'streamp)
39
  nil)