Commit 93a6891b authored by pfdietz's avatar pfdietz
Browse files

More formatter tests for ~( and ~p

parent d0225ecd
......@@ -26,6 +26,14 @@
collect (list x s))
nil)
(deftest formatter.p.5
(let ((fn (formatter "~p")))
(loop for x in *universe*
for s = (formatter-call-to-string fn x)
unless (or (eql x 1) (string= s "s"))
collect (list x s)))
nil)
;;; :p
(def-format-test format.p.6
......@@ -74,3 +82,11 @@
unless (or (eql x 1) (string= s "ies"))
collect (list x s))
nil)
(deftest formatter.p.18
(let ((fn (formatter "~@P")))
(loop for x in *universe*
for s = (formatter-call-to-string fn x)
unless (or (eql x 1) (string= s "ies"))
collect (list x s)))
nil)
......@@ -7,9 +7,8 @@
(compile-and-load "printer-aux.lsp")
(deftest format.paren.1
(format nil "~(XXyy~AuuVV~)" "ABc dEF ghI")
"xxyyabc def ghiuuvv")
(def-format-test format.paren.1
"~(XXyy~AuuVV~)" ("ABc dEF ghI") "xxyyabc def ghiuuvv")
;;; Conversion of simple characters to downcase
(deftest format.paren.2
......@@ -30,6 +29,26 @@
collect it)
nil)
(deftest formatter.paren.2
(let ((fn (formatter "~(~c~)")))
(loop for i from 0 below (min char-code-limit (ash 1 16))
for c = (code-char i)
when (and c
(eql (char-code c) (char-int c))
(upper-case-p c)
(let ((s1 (formatter-call-to-string fn c))
(s2 (string (char-downcase c))))
(if
(or (not (eql (length s1) 1))
(not (eql (length s2) 1))
(not (eql (elt s1 0)
(elt s2 0))))
(list i c s1 s2)
nil)))
collect it))
nil)
(def-format-test format.paren.3
"~@(this is a TEST.~)" nil "This is a test.")
......@@ -63,6 +82,25 @@
collect it)
nil)
(deftest formatter.paren.8
(let ((fn (formatter "~@:(~c~)")))
(loop for i from 0 below (min char-code-limit (ash 1 16))
for c = (code-char i)
when (and c
(eql (char-code c) (char-int c))
(lower-case-p c)
(let ((s1 (formatter-call-to-string fn c))
(s2 (string (char-upcase c))))
(if
(or (not (eql (length s1) 1))
(not (eql (length s2) 1))
(not (eql (elt s1 0)
(elt s2 0))))
(list i c s1 s2)
nil)))
collect it))
nil)
;;; Nested conversion
(def-format-test format.paren.9
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment