Commit 80ae0b3e authored by pfdietz's avatar pfdietz
Browse files

Add first test of (pprint-tab :line ...). There is an assumption about the...

Add first test of (pprint-tab :line ...).  There is an assumption about the behavior in a particular case.
parent 533a7e20
......@@ -86,11 +86,39 @@
(write "B" :stream t)))))
"A B")
;;; Now test actual tabbing behavior
;;; NOTE
;;; I am assuming that when colnum <= current column,
;;; and the current column == colnum + k * colinc for some positive integer k,
;;; then pprint-tab :line will tab at least 1 space.
(def-pprint-test pprint-tab.line.1
for offset = (random 100)
for colnum = (random 100)
for colinc = (min (random 50) (random 50))
for s = (with-output-to-string
(*standard-output* nil)
(dotimes (i offset) (write #\Space))
(pprint-tab :line colnum colinc)
(write #\A)))
for expected-col = (cond ((< offset colnum) colnum)
((= colinc 0) offset)
((= offset colnum) (+ offset colinc))
(t (let ((k (mod (- colnum offset) colinc)))
(if (= k 0)
(+ offset colinc)
(+ offset k)))))
repeat 200
(unless (string= s (concatenate
(make-string expected-col :initial-element #\Space)
(list (list offset colnum colinc expected-col (count #\Space s) s))))
:margin 1000)
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