aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index f8554636bac..641947d66a0 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -119,10 +119,9 @@
119 119
120 ;; In POSIX or C locales, collation order is lexicographic. 120 ;; In POSIX or C locales, collation order is lexicographic.
121 (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX")) 121 (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX"))
122 ;; In a language specific locale, collation order is different. 122 ;; In a language specific locale on MS-Windows, collation order is different.
123 (should (string-collate-lessp 123 (when (eq system-type 'windows-nt)
124 "xyzzy" "XYZZY" 124 (should (string-collate-lessp "xyzzy" "XYZZY" "enu_USA")))
125 (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))
126 125
127 ;; Ignore case. 126 ;; Ignore case.
128 (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) 127 (should (string-collate-equalp "xyzzy" "XYZZY" nil t))
@@ -154,8 +153,6 @@
154 (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) 153 (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
155 154
156(ert-deftest fns-tests-collate-sort () 155(ert-deftest fns-tests-collate-sort ()
157 ;; See https://lists.gnu.org/r/emacs-devel/2015-10/msg02505.html.
158 :expected-result (if (eq system-type 'cygwin) :failed :passed)
159 (skip-unless (fns-tests--collate-enabled-p)) 156 (skip-unless (fns-tests--collate-enabled-p))
160 157
161 ;; Punctuation and whitespace characters are relevant for POSIX. 158 ;; Punctuation and whitespace characters are relevant for POSIX.
@@ -165,15 +162,16 @@
165 (lambda (a b) (string-collate-lessp a b "POSIX"))) 162 (lambda (a b) (string-collate-lessp a b "POSIX")))
166 '("1 1" "1 2" "1.1" "1.2" "11" "12"))) 163 '("1 1" "1 2" "1.1" "1.2" "11" "12")))
167 ;; Punctuation and whitespace characters are not taken into account 164 ;; Punctuation and whitespace characters are not taken into account
168 ;; for collation in other locales. 165 ;; for collation in other locales, on MS-Windows systems.
169 (should 166 (when (eq system-type 'windows-nt)
170 (equal 167 (should
171 (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") 168 (equal
172 (lambda (a b) 169 (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
173 (let ((w32-collate-ignore-punctuation t)) 170 (lambda (a b)
174 (string-collate-lessp 171 (let ((w32-collate-ignore-punctuation t))
175 a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) 172 (string-collate-lessp
176 '("11" "1 1" "1.1" "12" "1 2" "1.2"))) 173 a b "enu_USA"))))
174 '("11" "1 1" "1.1" "12" "1 2" "1.2"))))
177 175
178 ;; Diacritics are different letters for POSIX, they sort lexicographical. 176 ;; Diacritics are different letters for POSIX, they sort lexicographical.
179 (should 177 (should
@@ -181,15 +179,17 @@
181 (sort '("Ævar" "Agustín" "Adrian" "Eli") 179 (sort '("Ævar" "Agustín" "Adrian" "Eli")
182 (lambda (a b) (string-collate-lessp a b "POSIX"))) 180 (lambda (a b) (string-collate-lessp a b "POSIX")))
183 '("Adrian" "Agustín" "Eli" "Ævar"))) 181 '("Adrian" "Agustín" "Eli" "Ævar")))
184 ;; Diacritics are sorted between similar letters for other locales. 182 ;; Diacritics are sorted between similar letters for other locales,
185 (should 183 ;; on MS-Windows systems.
186 (equal 184 (when (eq system-type 'windows-nt)
187 (sort '("Ævar" "Agustín" "Adrian" "Eli") 185 (should
188 (lambda (a b) 186 (equal
189 (let ((w32-collate-ignore-punctuation t)) 187 (sort '("Ævar" "Agustín" "Adrian" "Eli")
190 (string-collate-lessp 188 (lambda (a b)
191 a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) 189 (let ((w32-collate-ignore-punctuation t))
192 '("Adrian" "Ævar" "Agustín" "Eli")))) 190 (string-collate-lessp
191 a b "enu_USA"))))
192 '("Adrian" "Ævar" "Agustín" "Eli")))))
193 193
194(ert-deftest fns-tests-string-version-lessp () 194(ert-deftest fns-tests-string-version-lessp ()
195 (should (string-version-lessp "foo2.png" "foo12.png")) 195 (should (string-version-lessp "foo2.png" "foo12.png"))