summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2006-09-07 21:05:58 +0000
committerKevin Ryde <user42@zip.com.au>2006-09-07 21:05:58 +0000
commitf23d8e80f06ad3fa4e23f1b69176abfaef3e66d3 (patch)
tree068c1c6b5ce8b43937142f39dd37eac5da5b7716
parentab4099e4af1bbe3c41617a6dd288d059a5942549 (diff)
downloadguile-f23d8e80f06ad3fa4e23f1b69176abfaef3e66d3.tar.gz
(~f): Test leading zeros bugfix.
-rw-r--r--test-suite/tests/format.test16
1 files changed, 15 insertions, 1 deletions
diff --git a/test-suite/tests/format.test b/test-suite/tests/format.test
index 033d0c66d..8747cfef8 100644
--- a/test-suite/tests/format.test
+++ b/test-suite/tests/format.test
@@ -1,7 +1,7 @@
;;;; format.test --- test suite for Guile's CL-ish format -*- scheme -*-
;;;; Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> --- June 2001
;;;;
-;;;; Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+;;;; Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -71,6 +71,20 @@
(string=? (format #f "~@d" 1) "+1"))))
;;;
+;;; ~f
+;;;
+
+(with-test-prefix "~f fixed-point"
+
+ (pass-if "1.5"
+ (string=? "1.5" (format #f "~f" 1.5)))
+
+ ;; in guile prior to 1.6.9 and 1.8.1, leading zeros were incorrectly
+ ;; stripped, moving the decimal point and giving "25.0" here
+ (pass-if "string 02.5"
+ (string=? "2.5" (format #f "~f" "02.5"))))
+
+;;;
;;; ~{
;;;