Various directives have colinc and mincol parameters, which should be
> 0 and >= 0 respectively.
;;;; format interpreters and support functions for simple output
(defun format-write-field (stream string mincol colinc minpad padchar padleft)
+ (when (and colinc (<= colinc 0))
+ (error 'format-error
+ :complaint "The value of colinc is ~a, should be a positive integer"
+ :args (list colinc)))
+ (when (and mincol (< mincol 0))
+ (error 'format-error
+ :complaint "The value of mincol is ~a, should be a non-negative integer"
+ :args (list mincol)))
(unless padleft
(write-string string stream))
(dotimes (i minpad)
(assert (equal (row-major-aref a i) (row-major-aref copy i)))))))))
:next))))
+(with-test (:name (:format :negative-colinc-and-mincol))
+ (assert (raises-error? (format nil "~-2a" 1)))
+ (assert (raises-error? (format nil "~,0a" 1))))
+
;;; success