diff options
author | Sebastian Reuße <seb@wirrsal.net> | 2018-03-11 16:43:52 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-03-13 09:09:58 +0100 |
commit | 4b19029a72ebd22002be33f29a4168e61fc1ec6f (patch) | |
tree | a7373cf0cc9c7580296a6d62aab22c8e2974e9ec | |
parent | 88bf8aef2812ac8baec27bf61084aafff36e3f56 (diff) | |
download | org-mode-4b19029a72ebd22002be33f29a4168e61fc1ec6f.tar.gz |
Improve ‘org-sort-list’ test
* test-org-list.el (test-org-list/sort): Take case-sensitive
vs. insensitive sorting into account.
-rw-r--r-- | testing/lisp/test-org-list.el | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el index 866ee47..e0c448c 100644 --- a/testing/lisp/test-org-list.el +++ b/testing/lisp/test-org-list.el @@ -1015,16 +1015,32 @@ (ert-deftest test-org-list/sort () "Test `org-sort-list'." ;; Sort alphabetically. - (should - (equal "- abc\n- def\n- xyz\n" - (org-test-with-temp-text "- def\n- xyz\n- abc\n" - (org-sort-list nil ?a) - (buffer-string)))) - (should - (equal "- xyz\n- def\n- abc\n" - (org-test-with-temp-text "- def\n- xyz\n- abc\n" - (org-sort-list nil ?A) - (buffer-string)))) + (let ((original-string-collate-lessp (symbol-function 'string-collate-lessp))) + (cl-letf (((symbol-function 'string-collate-lessp) + (lambda (s1 s2 &optional locale ignore-case) + (funcall original-string-collate-lessp + s1 s2 "C" ignore-case)))) + (should + (equal "- abc\n- def\n- XYZ\n" + (org-test-with-temp-text "- def\n- XYZ\n- abc\n" + (org-sort-list nil ?a) + (buffer-string)))) + (should + (equal "- XYZ\n- def\n- abc\n" + (org-test-with-temp-text "- def\n- XYZ\n- abc\n" + (org-sort-list nil ?A) + (buffer-string)))) + ;; Sort alphabetically (with case). + (should + (equal "- C\n- a\n- b\n" + (org-test-with-temp-text "- b\n- C\n- a\n" + (org-sort-list t ?a) + (buffer-string)))) + (should + (equal "- b\n- a\n- C\n" + (org-test-with-temp-text "- b\n- C\n- a\n" + (org-sort-list t ?A) + (buffer-string)))))) ;; Sort numerically. (should (equal "- 1\n- 2\n- 10\n" |