diff options
| author | Michael Albinus | 2014-09-07 10:24:44 +0200 |
|---|---|---|
| committer | Michael Albinus | 2014-09-07 10:24:44 +0200 |
| commit | 47ae4ce33d54643c8adb0a2f9791a4132e0eb306 (patch) | |
| tree | 2e66ab1891ec54ad7ddfea0d98eea0cb6b1b2bdf | |
| parent | b3bf18b3b87ac8f00857b8bfc3f2c74cf0e2fb7d (diff) | |
| download | emacs-47ae4ce33d54643c8adb0a2f9791a4132e0eb306.tar.gz emacs-47ae4ce33d54643c8adb0a2f9791a4132e0eb306.zip | |
* automated/fns-tests.el (fns-tests--collate-enabled-p): New function.
(fns-tests-collate-strings, fns-tests-collate-sort): Use it.
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/fns-tests.el | 17 |
2 files changed, 19 insertions, 3 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 28f6a918676..db3a35c3644 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-09-07 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * automated/fns-tests.el (fns-tests--collate-enabled-p): New function. | ||
| 4 | (fns-tests-collate-strings, fns-tests-collate-sort): Use it. | ||
| 5 | |||
| 1 | 2014-09-05 Michael Albinus <michael.albinus@gmx.de> | 6 | 2014-09-05 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * automated/fns-tests.el (fns-tests-compare-strings): In case | 8 | * automated/fns-tests.el (fns-tests-compare-strings): In case |
diff --git a/test/automated/fns-tests.el b/test/automated/fns-tests.el index aa9f35f338e..1894b44bf42 100644 --- a/test/automated/fns-tests.el +++ b/test/automated/fns-tests.el | |||
| @@ -101,10 +101,19 @@ | |||
| 101 | (should (= (compare-strings "んにちはコンニチハこ" nil nil "こんにちはコンニチハ" nil nil) 1)) | 101 | (should (= (compare-strings "んにちはコンニチハこ" nil nil "こんにちはコンニチハ" nil nil) 1)) |
| 102 | (should (= (compare-strings "こんにちはコンニチハ" nil nil "んにちはコンニチハこ" nil nil) -1))) | 102 | (should (= (compare-strings "こんにちはコンニチハ" nil nil "んにちはコンニチハこ" nil nil) -1))) |
| 103 | 103 | ||
| 104 | (defun fns-tests--collate-enabled-p () | ||
| 105 | "Check whether collation functions are enabled." | ||
| 106 | (and | ||
| 107 | ;; When there is no collation library, collation functions fall back | ||
| 108 | ;; to their lexicographic counterparts. We don't need to test then. | ||
| 109 | (not (ignore-errors (string-collate-equalp "" "" t))) | ||
| 110 | ;; We use a locale, which might not be installed. Check it. | ||
| 111 | (ignore-errors | ||
| 112 | (string-collate-equalp | ||
| 113 | "" "" (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) | ||
| 114 | |||
| 104 | (ert-deftest fns-tests-collate-strings () | 115 | (ert-deftest fns-tests-collate-strings () |
| 105 | ;; When there is no collation library, collation functions fall back | 116 | (skip-unless (fns-tests--collate-enabled-p)) |
| 106 | ;; to their lexicographic counterparts. We don't need to test then. | ||
| 107 | (skip-unless (not (ignore-errors (string-collate-equalp "" "" t)))) | ||
| 108 | 117 | ||
| 109 | (should (string-collate-equalp "xyzzy" "xyzzy")) | 118 | (should (string-collate-equalp "xyzzy" "xyzzy")) |
| 110 | (should-not (string-collate-equalp "xyzzy" "XYZZY")) | 119 | (should-not (string-collate-equalp "xyzzy" "XYZZY")) |
| @@ -146,6 +155,8 @@ | |||
| 146 | (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) | 155 | (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) |
| 147 | 156 | ||
| 148 | (ert-deftest fns-tests-collate-sort () | 157 | (ert-deftest fns-tests-collate-sort () |
| 158 | (skip-unless (fns-tests--collate-enabled-p)) | ||
| 159 | |||
| 149 | ;; Punctuation and whitespace characters are relevant for POSIX. | 160 | ;; Punctuation and whitespace characters are relevant for POSIX. |
| 150 | (should | 161 | (should |
| 151 | (equal | 162 | (equal |