[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/14: tests: Use 'pass-if-equal' for (ice-9 i18n) tests
From: |
Andy Wingo |
Subject: |
[Guile-commits] 10/14: tests: Use 'pass-if-equal' for (ice-9 i18n) tests. |
Date: |
Wed, 1 Mar 2017 15:21:05 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 47236c2476b72c2b9d20a2dde9d68b4dd8cc7152
Author: Ludovic Courtès <address@hidden>
Date: Sun Feb 12 23:42:09 2017 +0100
tests: Use 'pass-if-equal' for (ice-9 i18n) tests.
* test-suite/tests/i18n.test ("number->locale-string")
("format ~h", "monetary-amount->locale-string"): Use 'pass-if-equal'
instead of 'pass-if'.
---
test-suite/tests/i18n.test | 74 +++++++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 34 deletions(-)
diff --git a/test-suite/tests/i18n.test b/test-suite/tests/i18n.test
index 53ed932..4eef874 100644
--- a/test-suite/tests/i18n.test
+++ b/test-suite/tests/i18n.test
@@ -494,43 +494,50 @@
(with-test-prefix "C"
- (pass-if "no thousand separator"
+ (pass-if-equal "no thousand separator"
+ ""
;; Unlike in English, the "C" locale has no thousand separator.
;; If this doesn't hold, the following tests will fail.
- (string=? "" (locale-thousands-separator)))
+ (locale-thousands-separator))
- (pass-if "integer"
- (string=? "123456" (number->locale-string 123456)))
+ (pass-if-equal "integer"
+ "123456"
+ (number->locale-string 123456))
- (pass-if "fraction"
- (string=? "1234.567" (number->locale-string 1234.567)))
+ (pass-if-equal "fraction"
+ "1234.567"
+ (number->locale-string 1234.567))
- (pass-if "fraction, 1 digit"
- (string=? "1234.5" (number->locale-string 1234.567 1)))
+ (pass-if-equal "fraction, 1 digit"
+ "1234.5"
+ (number->locale-string 1234.567 1))
- (pass-if "positive inexact zero, 1 digit"
- (string=? "0.0" (number->locale-string .0 1))))
+ (pass-if-equal "positive inexact zero, 1 digit"
+ "0.0"
+ (number->locale-string .0 1)))
(with-test-prefix "French"
- (pass-if "integer"
+ (pass-if-equal "integer"
+ "123 456"
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "123 456" (number->locale-string 123456 #t fr))))))
+ (number->locale-string 123456 #t fr)))))
- (pass-if "fraction"
+ (pass-if-equal "fraction"
+ "1 234,567"
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "1 234,567" (number->locale-string 1234.567 #t fr))))))
+ (number->locale-string 1234.567 #t fr)))))
- (pass-if "fraction, 1 digit"
+ (pass-if-equal "fraction, 1 digit"
+ "1 234,5"
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "1 234,5"
- (number->locale-string 1234.567 1 fr))))))))
+ (number->locale-string 1234.567 1 fr)))))))
(with-test-prefix "format ~h"
@@ -540,47 +547,46 @@
(with-test-prefix "French"
- (pass-if "12345.5678"
+ (pass-if-equal "12345.6789"
+ "12 345,6789"
(under-french-locale-or-unresolved
(lambda ()
(if (null? (locale-digit-grouping %french-locale))
(throw 'unresolved)
- (string=? "12 345,6789"
- (format #f "~:h" 12345.6789 %french-locale)))))))
+ (format #f "~:h" 12345.6789 %french-locale))))))
(with-test-prefix "English"
- (pass-if "12345.5678"
+ (pass-if-equal "12345.6789"
+ "12,345.6789"
(under-american-english-locale-or-unresolved
(lambda ()
(if (null? (locale-digit-grouping %american-english-locale))
(throw 'unresolved)
- (string=? "12,345.6789"
- (format #f "~:h" 12345.6789
- %american-english-locale))))))))
+ (format #f "~:h" 12345.6789
+ %american-english-locale)))))))
(with-test-prefix "monetary-amount->locale-string"
(with-test-prefix "French"
- (pass-if "integer"
+ (pass-if-equal "integer"
+ "123 456 +EUR"
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "123 456 +EUR"
- (monetary-amount->locale-string 123456 #f fr))))))
+ (monetary-amount->locale-string 123456 #f fr)))))
- (pass-if "fraction"
+ (pass-if-equal "fraction"
+ "1 234,56 EUR "
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "1 234,56 EUR "
- (monetary-amount->locale-string 1234.567 #t
- fr))))))
+ (monetary-amount->locale-string 1234.567 #t fr)))))
- (pass-if "positive inexact zero"
+ (pass-if-equal "positive inexact zero"
+ "0,0 +EUR"
(under-french-locale-or-unresolved
(lambda ()
(let ((fr (make-locale LC_ALL %french-locale-name)))
- (string=? "0,0 +EUR"
- (monetary-amount->locale-string 0. #f fr))))))))
+ (monetary-amount->locale-string 0. #f fr)))))))
- [Guile-commits] branch master updated (33944f6 -> 1026a76), Andy Wingo, 2017/03/01
- [Guile-commits] 01/14: build: Check for /gnu/store file names upon "make dist"., Andy Wingo, 2017/03/01
- [Guile-commits] 11/14: tests: Choose a more plausible US English locale name., Andy Wingo, 2017/03/01
- [Guile-commits] 07/14: doc: Fix typo in site packages documentation., Andy Wingo, 2017/03/01
- [Guile-commits] 09/14: i18n: Do not represent zero as "-0"., Andy Wingo, 2017/03/01
- [Guile-commits] 05/14: tests: Avoid statprof test failure on systems without 'setitimer'., Andy Wingo, 2017/03/01
- [Guile-commits] 04/14: build: Honor $SOURCE_DATE_EPOCH for the recorded timestamp., Andy Wingo, 2017/03/01
- [Guile-commits] 06/14: doc: Fix typo in keywords documentation., Andy Wingo, 2017/03/01
- [Guile-commits] 10/14: tests: Use 'pass-if-equal' for (ice-9 i18n) tests.,
Andy Wingo <=
- [Guile-commits] 13/14: i18n: 'number->locale-string' guesses the minimum number of decimals., Andy Wingo, 2017/03/01
- [Guile-commits] 12/14: i18n: Fix corner cases for monetary and number string conversions., Andy Wingo, 2017/03/01
- [Guile-commits] 02/14: build: Compress with lzip too., Andy Wingo, 2017/03/01
- [Guile-commits] 03/14: scandir: Avoid 'stat' calls on each entry., Andy Wingo, 2017/03/01
- [Guile-commits] 08/14: Recognize sh3 as compilation targets, Andy Wingo, 2017/03/01
- [Guile-commits] 14/14: doc: Describe -e (module) on equal footing with (@ ...)., Andy Wingo, 2017/03/01