source: trunk/source/tests/ansi-tests/listen.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Jan 27 21:16:39 2004
4;;;; Contains: Tests of LISTEN
5
6(in-package :cl-test)
7
8(deftest listen.1
9  (with-input-from-string (s "") (listen s))
10  nil)
11
12(deftest listen.2
13  (with-input-from-string (s "x") (notnot-mv (listen s)))
14  t)
15
16(deftest listen.3
17  (with-input-from-string (*standard-input* "") (listen))
18  nil)
19
20(deftest listen.4
21  (with-input-from-string (*standard-input* "A") (notnot-mv (listen)))
22  t)
23
24;;; (deftest listen.5
25;;;  (when (interactive-stream-p *standard-input*)
26;;;    (clear-input) (listen))
27;;;  nil)
28
29(deftest listen.6
30  (with-input-from-string
31   (s "x")
32   (values
33    (read-char s)
34    (listen s)
35    (unread-char #\x s)
36    (notnot (listen s))
37    (read-char s)))
38  #\x nil nil t #\x)
39
40(deftest listen.7
41  (with-open-file
42   (s "listen.lsp")
43   (values
44    (notnot (listen s))
45    (handler-case
46     (locally (declare (optimize safety))
47              (loop (read-char s)))
48     (end-of-file () (listen s)))))
49  t nil)
50
51(deftest listen.8
52  (with-input-from-string
53   (is "abc")
54   (let ((*terminal-io* (make-two-way-stream is (make-broadcast-stream))))
55     (notnot-mv (listen t))))
56  t)
57
58(deftest listen.9
59  (with-input-from-string
60   (*standard-input* "345")
61   (notnot-mv (listen nil)))
62  t)
63
64;;; Error tests
65
66(deftest listen.error.1
67  :notes (:assume-no-simple-streams)
68  (signals-error (listen *standard-input* nil) program-error)
69  t)
70
71(deftest listen.error.2
72  (signals-error (listen *standard-input* nil nil) program-error)
73  t)
Note: See TracBrowser for help on using the repository browser.