Commit 04e0ea80 authored by pfdietz's avatar pfdietz

More formatter tests for ~[

parent 4d4457e5
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
collect (format nil "~[a~;b~;c~;d~;e~;f~;g~;h~;i~]" i)) collect (format nil "~[a~;b~;c~;d~;e~;f~;g~;h~;i~]" i))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" "")) ("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(deftest formatter.cond.7
(let ((fn (formatter "~[a~;b~;c~;d~;e~;f~;g~;h~;i~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn i)))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(def-format-test format.cond.8 (def-format-test format.cond.8
"~0[a~;b~;c~;d~]" (3) "a" 1) "~0[a~;b~;c~;d~]" (3) "a" 1)
...@@ -50,11 +56,23 @@ ...@@ -50,11 +56,23 @@
collect (format nil "~v[a~;b~;c~;d~;e~;f~;g~;h~;i~]" i nil)) collect (format nil "~v[a~;b~;c~;d~;e~;f~;g~;h~;i~]" i nil))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" "")) ("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(deftest formatter.cond.13
(let ((fn (formatter "~V[a~;b~;c~;d~;e~;f~;g~;h~;i~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn i nil)))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(deftest format.cond.14 (deftest format.cond.14
(loop for i from -1 to 10 (loop for i from -1 to 10
collect (format nil "~v[a~;b~;c~;d~;e~;f~;g~;h~;i~]" nil i)) collect (format nil "~v[a~;b~;c~;d~;e~;f~;g~;h~;i~]" nil i))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" "")) ("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(deftest formatter.cond.14
(let ((fn (formatter "~v[a~;b~;c~;d~;e~;f~;g~;h~;i~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn nil i)))
("" "a" "b" "c" "d" "e" "f" "g" "h" "i" "" ""))
(def-format-test format.cond.15 (def-format-test format.cond.15
"~#[A~;B~]" nil "A") "~#[A~;B~]" nil "A")
...@@ -70,6 +88,14 @@ ...@@ -70,6 +88,14 @@
collect (list i s)) collect (list i s))
nil) nil)
(deftest formatter.cond\:.1
(let ((fn (formatter "~[~:;a~]")))
(loop for i from -100 to 100
for s = (formatter-call-to-string fn i)
unless (or (zerop i) (string= s "a"))
collect (list i s)))
nil)
(def-format-test format.cond\:.2 (def-format-test format.cond\:.2
"~[a~:;b~]" (0) "a") "~[a~:;b~]" (0) "a")
...@@ -84,16 +110,34 @@ ...@@ -84,16 +110,34 @@
collect (format nil "~[a~;b~;c~;d~:;e~]" i)) collect (format nil "~[a~;b~;c~;d~:;e~]" i))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e")) ("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(deftest formatter.cond\:.5
(let ((fn (formatter "~[a~;b~;c~;d~:;e~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn i)))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(deftest format.cond\:.6 (deftest format.cond\:.6
(loop for i from -1 to 10 (loop for i from -1 to 10
collect (format nil "~v[a~;b~;c~;d~:;e~]" i nil)) collect (format nil "~v[a~;b~;c~;d~:;e~]" i nil))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e")) ("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(deftest formatter.cond\:.6
(let ((fn (formatter "~v[a~;b~;c~;d~:;e~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn i nil)))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(deftest format.cond\:.7 (deftest format.cond\:.7
(loop for i from -1 to 10 (loop for i from -1 to 10
collect (format nil "~v[a~;b~;c~;d~:;e~]" nil i)) collect (format nil "~v[a~;b~;c~;d~:;e~]" nil i))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e")) ("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(deftest formatter.cond\:.7
(let ((fn (formatter "~v[a~;b~;c~;d~:;e~]")))
(loop for i from -1 to 10
collect (formatter-call-to-string fn nil i)))
("e" "a" "b" "c" "d" "e" "e" "e" "e" "e" "e" "e"))
(def-format-test format.cond\:.8 (def-format-test format.cond\:.8
"~#[A~:;B~]" nil "A") "~#[A~:;B~]" nil "A")
...@@ -112,6 +156,14 @@ ...@@ -112,6 +156,14 @@
collect (list x s)) collect (list x s))
nil) nil)
(deftest formatter.\:cond.2
(let ((fn (formatter "~:[a~;b~]")))
(loop for x in *mini-universe*
for s = (formatter-call-to-string fn x)
when (and x (not (string= s "b")))
collect (list x s)))
nil)
;;; ~@[ ... ~] ;;; ~@[ ... ~]
(def-format-test format.@cond.1 (def-format-test format.@cond.1
......
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