File: write-char.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (51 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jan 18 20:50:31 2004
;;;; Contains: Tests of WRITE-CHAR

(in-package :cl-test)

(deftest write-char.1
  (loop for i from 0 to 255
	for c = (code-char i)
	when c
	unless (string= (with-output-to-string
			  (*standard-output*)
			  (write-char c))
			(string c))
	collect c)
  nil)

(deftest write-char.2
  (with-input-from-string
   (is "abcd")
   (with-output-to-string
     (os)
     (let ((*terminal-io* (make-two-way-stream is os)))
       (write-char #\$ t)
       (close *terminal-io*))))
  "$")

(deftest write-char.3
  (with-output-to-string
    (*standard-output*)
    (write-char #\: nil))
  ":")

;;; Error tests

(deftest write-char.error.1
  (signals-error (write-char) program-error)
  t)

(deftest write-char.error.2
  (signals-error
   (with-output-to-string
     (s)
     (write-char #\a s nil))
   program-error)
  t)

;;; More tests in other files