i18n: Skips ~h `format' tests when digit grouping info is missing.
authorLudovic Courtès <ludo@gnu.org>
Sat, 4 Feb 2012 22:38:47 +0000 (23:38 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 4 Feb 2012 22:38:47 +0000 (23:38 +0100)
* test-suite/tests/i18n.test ("format ~h"): Skip tests when
  `locale-digit-grouping' returns '().

test-suite/tests/i18n.test

index 335f450..ef08dd4 100644 (file)
 
 (with-test-prefix "format ~h"
 
+  ;; Some systems like Darwin lack the `GROUPING' nl_item, and thus
+  ;; `locale-digit-grouping' defaults to '(); skip the tests in that
+  ;; case.
+
   (with-test-prefix "French"
 
     (pass-if "12345.5678"
       (under-french-locale-or-unresolved
        (lambda ()
-         (string=? "12 345,6789"
-                   (format #f "~:h" 12345.6789 %french-locale))))))
+         (if (null? (locale-digit-grouping %french-locale))
+             (throw 'unresolved)
+             (string=? "12 345,6789"
+                       (format #f "~:h" 12345.6789 %french-locale)))))))
 
   (with-test-prefix "English"
 
     (pass-if "12345.5678"
       (under-american-english-locale-or-unresolved
        (lambda ()
-         (string=? "12,345.6789"
-                   (format #f "~:h" 12345.6789
-                           %american-english-locale)))))))
+         (if (null? (locale-digit-grouping %american-english-locale))
+             (throw 'unresolved)
+             (string=? "12,345.6789"
+                       (format #f "~:h" 12345.6789
+                               %american-english-locale))))))))
 
 (with-test-prefix "monetary-amount->locale-string"