Commit 2854ae28 authored by pfdietz's avatar pfdietz

Begin adding tests for streams (section 21)

parent 9c47a7a8
......@@ -60,6 +60,9 @@
;;; Tests of file operations
(load "load-files.lsp")
;;; Tests of streams
(load "load-streams.lsp")
;;; Tests of system construction
(load "features.lsp")
(load "disassemble.lsp")
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Tue Jan 13 19:39:27 2004
;;;; Contains: Tests for INPUT-STREAM-P
(in-package :cl-test)
(deftest input-stream-p.1
(notnot-mv (input-stream-p *standard-input*))
t)
(deftest input-stream-p.2
(notnot-mv (input-stream-p *terminal-io*))
t)
(deftest input-stream-p.3
(with-open-file (s "input-stream-p.lsp" :direction :input)
(notnot-mv (input-stream-p s)))
t)
(deftest input-stream-p.4
(with-open-file (s "foo.txt" :direction :output
:if-exists :supersede)
(input-stream-p s))
nil)
;;; Error tests
(deftest input-stream-p.error.1
(classify-error (input-stream-p))
program-error)
(deftest input-stream-p.error.2
(classify-error (input-stream-p *standard-input* nil))
program-error)
(deftest input-stream-p.error.3
(loop for x in *mini-universe*
unless (or (typep x 'stream)
(not (eq (eval `(classify-error (input-stream-p ',x)))
'type-error)))
collect x)
nil)
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Tue Jan 13 19:47:59 2004
;;;; Contains: Tests of INTERACTIVE-STREAM-P
(in-package :cl-test)
(deftest interactive-stream-p.1
(let ((streams (list *debug-io* *error-output* *query-io*
*standard-input* *standard-output*
*trace-output* *terminal-io*)))
(mapc #'interactive-stream-p streams)
;; no error should occur
nil)
nil)
(deftest interactive-stream-p.error.1
(loop for x in *mini-universe*
unless (or (typep x 'stream)
(eql (eval `(classify-error (interactive-stream-p ',x)))
'type-error))
collect x)
nil)
(deftest interactive-stream-p.error.2
(classify-error (interactive-stream-p))
program-error)
(deftest interactive-stream-p.error.3
(classify-error (interactive-stream-p *terminal-io* nil))
program-error)
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Tue Jan 13 19:38:10 2004
;;;; Contains: Load files containing tests for section 21 (streams)
(in-package :cl-test)
(load "input-stream-p.lsp")
(load "output-stream-p.lsp")
(load "interactive-stream-p.lsp")
(load "open-stream-p.lsp")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Tue Jan 13 19:52:30 2004
;;;; Contains: Tests of OPEN-STREAM-P
(in-package :cl-test)
(deftest open-stream-p.1
(loop for s in (list *debug-io* *error-output* *query-io*
*standard-input* *standard-output*
*trace-output* *terminal-io*)
for results = (multiple-value-list (open-stream-p s))
unless (and (eql (length results) 1)
(car results))
collect s)
nil)
(deftest open-stream-p.2
(with-open-file (s "open-stream-p.lsp" :direction :input)
(notnot-mv (open-stream-p s)))
t)
(deftest open-stream-p.3
(with-open-file (s "foo.txt" :direction :output
:if-exists :supersede)
(notnot-mv (open-stream-p s)))
t)
(deftest open-stream-p.4
(let ((s (open "open-stream-p.lsp" :direction :input)))
(close s)
(open-stream-p s))
nil)
(deftest open-stream-p.5
(let ((s (open "foo.txt" :direction :output
:if-exists :supersede)))
(close s)
(open-stream-p s))
nil)
;;; error tests
(deftest open-stream-p.error.1
(classify-error (open-stream-p))
program-error)
(deftest open-stream-p.error.2
(classify-error (open-stream-p *standard-input* nil))
program-error)
(deftest open-stream-p.3
(loop for x in *mini-universe*
unless (or (typep x 'stream)
(eql (eval `(classify-error (open-stream-p ',x)))
'type-error))
collect x)
nil)
;-*- 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)
(output-stream-p s))
nil)
(deftest output-stream-p.4
(with-open-file (s "foo.txt" :direction :output
:if-exists :supersede)
(notnot-mv (output-stream-p s)))
t)
;;; Error tests
(deftest output-stream-p.error.1
(classify-error (output-stream-p))
program-error)
(deftest output-stream-p.error.2
(classify-error (output-stream-p *standard-output* nil))
program-error)
(deftest output-stream-p.error.3
(loop for x in *mini-universe*
unless (or (typep x 'stream)
(not (eq (eval `(classify-error (output-stream-p ',x)))
'type-error)))
collect x)
nil)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment