diff options
| author | Nicolas Petton | 2015-06-04 18:20:18 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-06-04 18:27:54 +0200 |
| commit | 41a929c5ae1110e39f94c018dc2b3e224e884f18 (patch) | |
| tree | 6fc7c92f12861766329c6d4daac52bf9547a77ea /test | |
| parent | 285260fce84c945acb588a7c70d3df5d8271f586 (diff) | |
| download | emacs-41a929c5ae1110e39f94c018dc2b3e224e884f18.tar.gz emacs-41a929c5ae1110e39f94c018dc2b3e224e884f18.zip | |
Add new function string-greaterp
* lisp/subr.el (string-greaterp): New function. Also aliased to
`string>'.
* test/automated/subr-tests.el (string-comparison-test): Add unit
tests for `string>'and `string<'.
* src/fns.c (string-lessp): Better docstring.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/subr-tests.el | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/automated/subr-tests.el b/test/automated/subr-tests.el index d29efc6f330..28a423f5ee8 100644 --- a/test/automated/subr-tests.el +++ b/test/automated/subr-tests.el | |||
| @@ -2,7 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Oleh Krehel <ohwoeowho@gmail.com> | 5 | ;; Author: Oleh Krehel <ohwoeowho@gmail.com>, |
| 6 | ;; Nicolas Petton <nicolas@petton.fr> | ||
| 6 | ;; Keywords: | 7 | ;; Keywords: |
| 7 | 8 | ||
| 8 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| @@ -60,5 +61,26 @@ | |||
| 60 | (quote | 61 | (quote |
| 61 | (0 font-lock-keyword-face)))))))) | 62 | (0 font-lock-keyword-face)))))))) |
| 62 | 63 | ||
| 64 | (ert-deftest string-comparison-test () | ||
| 65 | (should (string-lessp "abc" "acb")) | ||
| 66 | (should (string-lessp "aBc" "abc")) | ||
| 67 | (should (string-lessp "abc" "abcd")) | ||
| 68 | (should (string-lessp "abc" "abcd")) | ||
| 69 | (should-not (string-lessp "abc" "abc")) | ||
| 70 | (should-not (string-lessp "" "")) | ||
| 71 | |||
| 72 | (should (string-greaterp "acb" "abc")) | ||
| 73 | (should (string-greaterp "abc" "aBc")) | ||
| 74 | (should (string-greaterp "abcd" "abc")) | ||
| 75 | (should (string-greaterp "abcd" "abc")) | ||
| 76 | (should-not (string-greaterp "abc" "abc")) | ||
| 77 | (should-not (string-greaterp "" "")) | ||
| 78 | |||
| 79 | ;; Symbols are also accepted | ||
| 80 | (should (string-lessp 'abc 'acb)) | ||
| 81 | (should (string-lessp "abc" 'acb)) | ||
| 82 | (should (string-greaterp 'acb 'abc)) | ||
| 83 | (should (string-greaterp "acb" 'abc))) | ||
| 84 | |||
| 63 | (provide 'subr-tests) | 85 | (provide 'subr-tests) |
| 64 | ;;; subr-tests.el ends here | 86 | ;;; subr-tests.el ends here |