~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to ansi-tests/clear-input.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;-*- Mode:     Lisp -*-
 
2
;;;; Author:   Paul Dietz
 
3
;;;; Created:  Wed Jan 28 06:12:39 2004
 
4
;;;; Contains: Tests of CLEAR-INPUT
 
5
 
 
6
(in-package :cl-test)
 
7
 
 
8
;;; These tests are limited, since whether an input stream can be
 
9
;;; cleared is not well specified.
 
10
 
 
11
(deftest clear-input.1
 
12
  (loop for s in (list *debug-io* *query-io*
 
13
                       *standard-input* *terminal-io*)
 
14
        always (eq (clear-input s) nil))
 
15
  t)
 
16
 
 
17
(deftest clear-input.2
 
18
  (clear-input)
 
19
  nil)
 
20
 
 
21
(deftest clear-input.3
 
22
  (clear-input nil)
 
23
  nil)
 
24
 
 
25
(deftest clear-input.4
 
26
  (clear-input t)
 
27
  nil)
 
28
 
 
29
(deftest clear-input.5
 
30
  (with-input-from-string
 
31
   (is "!?*")
 
32
   (let ((*terminal-io* (make-two-way-stream is (make-broadcast-stream))))
 
33
     (clear-input t)))
 
34
  nil)
 
35
 
 
36
(deftest clear-input.6
 
37
  (with-input-from-string
 
38
   (*standard-input* "345")
 
39
   (clear-input nil))
 
40
  nil)
 
41
 
 
42
;;; Error cases
 
43
 
 
44
(deftest clear-input.error.1
 
45
  :notes (:assume-no-simple-streams)
 
46
  (signals-error (clear-input t nil) program-error)
 
47
  t)
 
48
 
 
49
(deftest clear-input.error.2
 
50
  :notes (:assume-no-simple-streams)
 
51
  (signals-error (clear-input nil nil) program-error)
 
52
  t)
 
53
 
 
54
(deftest clear-input.error.3
 
55
  (signals-error (clear-input t nil nil) program-error)
 
56
  t)
 
57
 
 
58
(deftest clear-input.error.4
 
59
  (signals-error (clear-input nil nil nil) program-error)
 
60
  t)
 
61
 
 
62
(deftest clear-input.error.5
 
63
  (loop for x in *mini-universe*
 
64
        unless (or (member x '(nil t))
 
65
                   (typep x 'stream)
 
66
                   (equalt
 
67
                    (eval `(multiple-value-list
 
68
                            (signals-error (clear-input ',x) type-error)))
 
69
                    '(t)))
 
70
        collect x)
 
71
  nil)
 
72
 
 
73