format-page.lsp 1.14 KB
Newer Older
1
2
3
4
5
6
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Jul 28 00:20:46 2004
;;;; Contains: Tests of format with ~| directive

(in-package :cl-test)
7
(compile-and-load "printer-aux.lsp")
8

9
10
(def-format-test format.page.1
  "~0|" nil "")
11
12
13
14
15
16
17
18

(deftest format.page.2
  (let ((s (format nil "~|")))
    (cond
     ((string= s "") nil)
     ((> (length s) 1) (values s :too-long))
     (t
      (let ((c (elt s 0)))
sds's avatar
sds committed
19
20
21
22
23
        (loop for i from 2 to 100
              for s = (format nil (format nil "~~~D|" i))
              unless (and (= (length s) i)
                          (every #'(lambda (c2) (char= c c2)) s))
              collect i)))))
24
25
26
27
28
29
30
31
32
  nil)

(deftest format.page.3
  (let ((s (format nil "~|")))
    (cond
     ((string= s "") nil)
     ((> (length s) 1) (values s :too-long))
     (t
      (let ((c (elt s 0)))
sds's avatar
sds committed
33
34
35
36
37
        (loop for i from 2 to 100
              for s = (format nil "~v|" i)
              unless (and (= (length s) i)
                          (every #'(lambda (c2) (char= c c2)) s))
              collect i)))))
38
39
  nil)

40
41
(def-format-test format.page.4
  "~V|" (0) "")
42

43
44
(def-format-test format.page.5
  "~v|" (nil) #.(format nil "~|"))