(~@d): New tests.
authorKevin Ryde <user42@zip.com.au>
Wed, 1 Sep 2004 22:54:28 +0000 (22:54 +0000)
committerKevin Ryde <user42@zip.com.au>
Wed, 1 Sep 2004 22:54:28 +0000 (22:54 +0000)
test-suite/tests/format.test

index 90f24ef..3ee5ef5 100644 (file)
   (pass-if "format ~F (format-out-substr) maintains the column correctly"
           (= (string-length (format "~@F~20T" 1)) 20)))
 
+;;;
+;;; ~d
+;;;
+
+(with-test-prefix "~d decimal integer"
+
+  (with-test-prefix "~@d"
+
+    (pass-if "-1"
+      (string=? (format #f "~@d" -1) "-1"))
+    ;; in guile 1.6.4 and earlier, ~@d gave "0" but we think "+0" is what the
+    ;; common lisp spec intendes
+    (pass-if "+0"
+      (string=? (format #f "~@d" 0) "+0"))
+
+    (pass-if "+1"
+      (string=? (format #f "~@d" 1) "+1"))))
+
+;;;
+;;; ~t
+;;;
+
+(with-test-prefix "~t column advance"
+
+  ;; in guile 1.6.4 and earlier, a newline as a fill character didn't zero
+  ;; the column number, making a subsequent ~t wrong
+  (pass-if "newline as fill character"
+    (string=? (format #f "~6,'\nd~8tX" 123)
+             "\n\n\n123     X")))
+
 ;;;
 ;;; ~{
 ;;;