]> git.eshelyaron.com Git - emacs.git/commitdiff
* automated/fns-tests.el (fns-tests--collate-enabled-p): New function.
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 7 Sep 2014 08:24:44 +0000 (10:24 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 7 Sep 2014 08:24:44 +0000 (10:24 +0200)
(fns-tests-collate-strings, fns-tests-collate-sort): Use it.

test/ChangeLog
test/automated/fns-tests.el

index 28f6a918676df9c38ba186c32f9884c4cfaded2f..db3a35c3644f56ce64067fcbda08d0e5db8e7113 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-07  Michael Albinus  <michael.albinus@gmx.de>
+
+       * automated/fns-tests.el (fns-tests--collate-enabled-p): New function.
+       (fns-tests-collate-strings, fns-tests-collate-sort): Use it.
+
 2014-09-05  Michael Albinus  <michael.albinus@gmx.de>
 
        * automated/fns-tests.el (fns-tests-compare-strings): In case
index aa9f35f338e0121d25f3e2f8518c51518f9e984e..1894b44bf42f5f9335747d1e123119e3d87cea10 100644 (file)
   (should (= (compare-strings "んにちはコンニチハこ" nil nil "こんにちはコンニチハ" nil nil) 1))
   (should (= (compare-strings "こんにちはコンニチハ" nil nil "んにちはコンニチハこ" nil nil) -1)))
 
+(defun fns-tests--collate-enabled-p ()
+  "Check whether collation functions are enabled."
+  (and
+   ;; When there is no collation library, collation functions fall back
+   ;; to their lexicographic counterparts.  We don't need to test then.
+   (not (ignore-errors (string-collate-equalp "" "" t)))
+   ;; We use a locale, which might not be installed.  Check it.
+   (ignore-errors
+     (string-collate-equalp
+      "" "" (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
+
 (ert-deftest fns-tests-collate-strings ()
-  ;; When there is no collation library, collation functions fall back
-  ;; to their lexicographic counterparts.  We don't need to test then.
-  (skip-unless (not (ignore-errors (string-collate-equalp "" "" t))))
+  (skip-unless (fns-tests--collate-enabled-p))
 
   (should (string-collate-equalp "xyzzy" "xyzzy"))
   (should-not (string-collate-equalp "xyzzy" "XYZZY"))
            (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
 
 (ert-deftest fns-tests-collate-sort ()
+  (skip-unless (fns-tests--collate-enabled-p))
+
   ;; Punctuation and whitespace characters are relevant for POSIX.
   (should
    (equal