1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
Commit graph

19 commits

Author SHA1 Message Date
Ludovic Courtès
de5cf50aba i18n: 'number->locale-string' guesses the minimum number of decimals.
This feature was removed by 4aead68cdb.

* module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where
DIGIT-COUNT is not an integer.
(number->locale-string): Always pass FRACTION-DIGITS to
'number-decimal-string'.
* test-suite/tests/format.test ("~h localized number")["1234.5"]
["padding", "padchar"]: Remove decimal specifier.
* test-suite/tests/i18n.test ("number->locale-string")
["fraction",
* test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal
specifier.  Remove one decimal.
* doc/ref/api-i18n.texi (Number Input and Output): Update
'number->locale-string' doc to mention the number of decimals.
2017-03-01 21:16:49 +01:00
Ludovic Courtès
4c7d1a64fa i18n: Fix corner cases for monetary and number string conversions.
Fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.

* module/ice-9/i18n.scm (integer->string, number-decimal-string): New
procedures.
(monetary-amount->locale-string): Use them instead of 'number->string'
followed by 'string-split'.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["fraction"]: Add
second argument to 'number->locale-string'.
["fraction, 1 digit"]: Round up.
["fraction, 10 digits", "trailing zeros", "negative integer"]: New
tests.
* test-suite/tests/i18n.test ("format ~h"): Pass the number of decimals
for ~h.
("monetary-amount->locale-string")["French"]: Always expect two decimals
after the comma.
["one cent", "very little money"]: New tests.
* test-suite/tests/format.test ("~h localized number")["1234.5"]:
Specify the number of decimals explicitly.
["padding"]: Expect zero decimals.
["padchar"]: Ask for one decimal.
["decimals", "locale"]: Adjust rounding.
2017-03-01 21:16:25 +01:00
Daniel Llorens
546eb479b1 Test format ~f with width parameters
* test-suite/tests/format.test: Additional tests for ~f.
2016-12-15 12:47:08 +01:00
Ludovic Courtès
f2c3d29fd2 tests: Check 'simple-format' with closed current-output-port.
This is a follow-up to e26ab06.

* libguile/print.c (scm_simple_format): Pass 1 to
  SCM_VALIDATE_OPORT_VALUE, for 'destination'.
* test-suite/tests/format.test ("simple-format"): Add test.
2014-03-20 09:40:42 +01:00
Mark H Weaver
0ce224594a Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.
2014-02-07 21:49:35 -05:00
Ludovic Courtès
afd08fdf87 format: Add specifier ~h for localized number output.
* doc/ref/misc-modules.texi (Formatted Output): Document ~h.  Recommend
  use of ~h instead of ~:d.

* module/ice-9/format.scm (format): Add support for ~h.

* test-suite/tests/format.test ("~h localized number"): New test prefix.

* test-suite/tests/i18n.test (%american-english-locale-name,
  %american-english-locale): New variables.
  (under-american-english-locale-or-unresolved): New procedure.
  ("format ~h"): New test prefix.
2012-02-03 16:35:06 +01:00
Ludovic Courtès
1497e87a4f Make `(format #f ...)' always Unicode-capable.
* module/ice-9/format.scm (format): When DESTINATION is #f, use a
  Unicode-capable output string port.

* test-suite/tests/format.test ("format basic output")["default to
  Unicode-capable port"]: New test.
2011-02-08 23:14:00 +01:00
Andy Wingo
2ce77e6cf6 deprecate omission of port to ice-9 format
* module/ice-9/format.scm (format): Add port and format-string as formal
  arguments. Seems also to have triggered a reindent.  Formally
  deprecate omitting the port, as it's usually an error.

* test-suite/tests/format.test ("format basic output")
  ("format basic output", "~{ iteration"): Fix up tests that omitted the
  destination port.
2010-12-18 12:06:53 +01:00
Andy Wingo
625b43acc7 fix `format' with %f and exact rationals
* module/ice-9/format.scm (format:parse-float): Accept a number, and
  when stringifying the number, first convert to inexact.

* test-suite/tests/format.test ("~f fixed-point"): Add exact rational
  test.
2010-06-06 13:46:53 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Kevin Ryde
8ab3d8a068 merge from 1.8 branch 2006-10-09 23:40:48 +00:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
d8b189d2c3 New tests of excess arguments now ignored. 2004-09-01 23:36:47 +00:00
Kevin Ryde
a8cb8832af Oops, didn't mean to put ~t yet. 2004-09-01 23:10:23 +00:00
Kevin Ryde
992b375d61 (~@d): New tests. 2004-09-01 22:54:28 +00:00
Kevin Ryde
4fb318013b 2004-05-25 Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
* tests/format.test (~{): Test no arbitrary iteration limit.
2004-07-19 00:58:04 +00:00
Marius Vollmer
6c61859f03 ("format basic output"): Added test for "~F" from Matthias Koeppe. 2003-03-19 18:28:52 +00:00
Marius Vollmer
025f75b48f New files. Thanks to Matthias Köppe! 2001-06-16 20:11:39 +00:00