source: trunk/source/tests/ansi-tests/fresh-line.lsp @ 8991

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

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

File size: 1.9 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Jan 18 20:41:18 2004
4;;;; Contains: Tests of FRESH-LINE
5
6(in-package :cl-test)
7
8(deftest fresh-line.1
9  (let (result)
10    (values
11     (with-output-to-string
12       (*standard-output*)
13       (write-char #\a)
14       (setq result (notnot (fresh-line))))
15     result))
16  #.(concatenate 'string "a" (string #\Newline))
17  t)
18
19(deftest fresh-line.2
20  (let (result)
21    (values
22     (with-output-to-string
23       (s)
24       (write-char #\a s)
25       (setq result (notnot (fresh-line s))))
26     result))
27  #.(concatenate 'string "a" (string #\Newline))
28  t)
29
30(deftest fresh-line.3
31  (with-output-to-string
32    (s)
33    (write-char #\x s)
34    (fresh-line s)
35    (fresh-line s)
36    (write-char #\y s))
37  #.(concatenate 'string "x" (string #\Newline) "y"))
38
39(deftest fresh-line.4
40  (let (result)
41    (values
42     (with-output-to-string
43       (*standard-output*)
44       (setq result (multiple-value-list (fresh-line))))
45     result))
46  "" (nil))
47
48(deftest fresh-line.5
49  (let (result)
50    (values
51     (with-output-to-string
52       (s)
53       (write-char #\Space s)
54       (setq result
55             (list
56              (multiple-value-list (notnot-mv (fresh-line s)))
57              (multiple-value-list (fresh-line s))
58              (multiple-value-list (fresh-line s)))))
59     result))
60  "
61" ((t) (nil) (nil)))
62
63(deftest fresh-line.6
64  (with-output-to-string
65    (os)
66    (let ((*terminal-io* (make-two-way-stream *standard-input* os)))
67      (write-char #\a t)
68      (fresh-line t)
69      (finish-output t)))
70  #.(concatenate 'string (string #\a) (string #\Newline)))
71
72(deftest fresh-line.7
73  (with-output-to-string
74    (*standard-output*)
75    (write-char #\a nil)
76    (terpri nil))
77  #.(concatenate 'string (string #\a) (string #\Newline)))
78
79;;; Error tests
80
81(deftest fresh-line.error.1
82  (signals-error
83   (with-output-to-string
84     (s)
85     (fresh-line s nil))
86   program-error)
87  t)
Note: See TracBrowser for help on using the repository browser.