emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 f4b5ff2: Port collation tests to glibc 2.27


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 f4b5ff2: Port collation tests to glibc 2.27
Date: Wed, 2 May 2018 14:46:08 -0400 (EDT)

branch: emacs-26
commit f4b5ff20a663db483ee4bb3e60c34ce4cd2d6d70
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port collation tests to glibc 2.27
    
    * test/src/fns-tests.el (fns-tests-collate-strings)
    (fns-tests-collate-sort): Don’t make unportable assumptions
    about how en_US.UTF-8 collation works.  These assumptions
    are not true on Fedora 28, which ships with glibc 2.27.
---
 test/src/fns-tests.el | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index f855463..641947d 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -119,10 +119,9 @@
 
   ;; In POSIX or C locales, collation order is lexicographic.
   (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX"))
-  ;; In a language specific locale, collation order is different.
-  (should (string-collate-lessp
-          "xyzzy" "XYZZY"
-          (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))
+  ;; In a language specific locale on MS-Windows, collation order is different.
+  (when (eq system-type 'windows-nt)
+    (should (string-collate-lessp "xyzzy" "XYZZY" "enu_USA")))
 
   ;; Ignore case.
   (should (string-collate-equalp "xyzzy" "XYZZY" nil t))
@@ -154,8 +153,6 @@
            (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
 
 (ert-deftest fns-tests-collate-sort ()
-  ;; See https://lists.gnu.org/r/emacs-devel/2015-10/msg02505.html.
-  :expected-result (if (eq system-type 'cygwin) :failed :passed)
   (skip-unless (fns-tests--collate-enabled-p))
 
   ;; Punctuation and whitespace characters are relevant for POSIX.
@@ -165,15 +162,16 @@
          (lambda (a b) (string-collate-lessp a b "POSIX")))
     '("1 1" "1 2" "1.1" "1.2" "11" "12")))
   ;; Punctuation and whitespace characters are not taken into account
-  ;; for collation in other locales.
-  (should
-   (equal
-    (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
-         (lambda (a b)
-           (let ((w32-collate-ignore-punctuation t))
-             (string-collate-lessp
-              a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
-    '("11" "1 1" "1.1" "12" "1 2" "1.2")))
+  ;; for collation in other locales, on MS-Windows systems.
+  (when (eq system-type 'windows-nt)
+    (should
+     (equal
+      (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
+            (lambda (a b)
+              (let ((w32-collate-ignore-punctuation t))
+                (string-collate-lessp
+                 a b "enu_USA"))))
+      '("11" "1 1" "1.1" "12" "1 2" "1.2"))))
 
   ;; Diacritics are different letters for POSIX, they sort lexicographical.
   (should
@@ -181,15 +179,17 @@
     (sort '("Ævar" "Agustín" "Adrian" "Eli")
          (lambda (a b) (string-collate-lessp a b "POSIX")))
     '("Adrian" "Agustín" "Eli" "Ævar")))
-  ;; Diacritics are sorted between similar letters for other locales.
-  (should
-   (equal
-    (sort '("Ævar" "Agustín" "Adrian" "Eli")
-         (lambda (a b)
-           (let ((w32-collate-ignore-punctuation t))
-             (string-collate-lessp
-              a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
-    '("Adrian" "Ævar" "Agustín" "Eli"))))
+  ;; Diacritics are sorted between similar letters for other locales,
+  ;; on MS-Windows systems.
+  (when (eq system-type 'windows-nt)
+    (should
+     (equal
+      (sort '("Ævar" "Agustín" "Adrian" "Eli")
+            (lambda (a b)
+              (let ((w32-collate-ignore-punctuation t))
+                (string-collate-lessp
+                 a b "enu_USA"))))
+      '("Adrian" "Ævar" "Agustín" "Eli")))))
 
 (ert-deftest fns-tests-string-version-lessp ()
   (should (string-version-lessp "foo2.png" "foo12.png"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]