7 |
|
|
8 |
(compile-and-load "printer-aux.lsp") |
(compile-and-load "printer-aux.lsp") |
9 |
|
|
10 |
(deftest format.paren.1 |
(def-format-test format.paren.1 |
11 |
(format nil "~(XXyy~AuuVV~)" "ABc dEF ghI") |
"~(XXyy~AuuVV~)" ("ABc dEF ghI") "xxyyabc def ghiuuvv") |
|
"xxyyabc def ghiuuvv") |
|
12 |
|
|
13 |
;;; Conversion of simple characters to downcase |
;;; Conversion of simple characters to downcase |
14 |
(deftest format.paren.2 |
(deftest format.paren.2 |
29 |
collect it) |
collect it) |
30 |
nil) |
nil) |
31 |
|
|
32 |
|
(deftest formatter.paren.2 |
33 |
|
(let ((fn (formatter "~(~c~)"))) |
34 |
|
(loop for i from 0 below (min char-code-limit (ash 1 16)) |
35 |
|
for c = (code-char i) |
36 |
|
when (and c |
37 |
|
(eql (char-code c) (char-int c)) |
38 |
|
(upper-case-p c) |
39 |
|
(let ((s1 (formatter-call-to-string fn c)) |
40 |
|
(s2 (string (char-downcase c)))) |
41 |
|
(if |
42 |
|
(or (not (eql (length s1) 1)) |
43 |
|
(not (eql (length s2) 1)) |
44 |
|
(not (eql (elt s1 0) |
45 |
|
(elt s2 0)))) |
46 |
|
(list i c s1 s2) |
47 |
|
nil))) |
48 |
|
collect it)) |
49 |
|
nil) |
50 |
|
|
51 |
|
|
52 |
(def-format-test format.paren.3 |
(def-format-test format.paren.3 |
53 |
"~@(this is a TEST.~)" nil "This is a test.") |
"~@(this is a TEST.~)" nil "This is a test.") |
54 |
|
|
82 |
collect it) |
collect it) |
83 |
nil) |
nil) |
84 |
|
|
85 |
|
(deftest formatter.paren.8 |
86 |
|
(let ((fn (formatter "~@:(~c~)"))) |
87 |
|
(loop for i from 0 below (min char-code-limit (ash 1 16)) |
88 |
|
for c = (code-char i) |
89 |
|
when (and c |
90 |
|
(eql (char-code c) (char-int c)) |
91 |
|
(lower-case-p c) |
92 |
|
(let ((s1 (formatter-call-to-string fn c)) |
93 |
|
(s2 (string (char-upcase c)))) |
94 |
|
(if |
95 |
|
(or (not (eql (length s1) 1)) |
96 |
|
(not (eql (length s2) 1)) |
97 |
|
(not (eql (elt s1 0) |
98 |
|
(elt s2 0)))) |
99 |
|
(list i c s1 s2) |
100 |
|
nil))) |
101 |
|
collect it)) |
102 |
|
nil) |
103 |
|
|
104 |
;;; Nested conversion |
;;; Nested conversion |
105 |
|
|
106 |
(def-format-test format.paren.9 |
(def-format-test format.paren.9 |