summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2019-11-12 02:01:22 +0100
committerStefan Kangas <stefankangas@gmail.com>2020-01-24 18:28:53 +0100
commitfcad41c14db874f139db45cbf9e90f7309687d20 (patch)
tree1e6a16ee96fffbbb8544155f1127121dfb265ceb
parenta76e7d592f428e04b868724c9dfe57d35eb3744e (diff)
downloademacs-fcad41c14db874f139db45cbf9e90f7309687d20.tar.gz
Add tests for version comparison predicates
* test/lisp/subr-tests.el (subr-test-version-list-<) (subr-test-version-list-=, subr-test-version-list-<=): New tests.
-rw-r--r--test/lisp/subr-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 059d52b1b6f..a583d57d2e8 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -244,6 +244,27 @@
(error-message-string (should-error (version-to-list "beta22_8alpha3")))
"Invalid version syntax: `beta22_8alpha3' (must start with a number)"))))
+(ert-deftest subr-test-version-list-< ()
+ (should (version-list-< '(0) '(1)))
+ (should (version-list-< '(0 9) '(1 0)))
+ (should (version-list-< '(1 -1) '(1 0)))
+ (should (version-list-< '(1 -2) '(1 -1)))
+ (should (not (version-list-< '(1) '(0))))
+ (should (not (version-list-< '(1 1) '(1 0))))
+ (should (not (version-list-< '(1) '(1 0))))
+ (should (not (version-list-< '(1 0) '(1 0 0)))))
+
+(ert-deftest subr-test-version-list-= ()
+ (should (version-list-= '(1) '(1)))
+ (should (version-list-= '(1 0) '(1)))
+ (should (not (version-list-= '(0) '(1)))))
+
+(ert-deftest subr-test-version-list-<= ()
+ (should (version-list-<= '(0) '(1)))
+ (should (version-list-<= '(1) '(1)))
+ (should (version-list-<= '(1 0) '(1)))
+ (should (not (version-list-<= '(1) '(0)))))
+
(defun subr-test--backtrace-frames-with-backtrace-frame (base)
"Reference implementation of `backtrace-frames'."
(let ((idx 0)