branch: externals/compat
commit 0c25479bef85058016e4b4f01a33d7e63c20c0fd
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Restore tests
---
compat-tests.el | 64 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/compat-tests.el b/compat-tests.el
index ab10324809..491fb09908 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -125,6 +125,38 @@
((lop (and (setq b (not b)) (1+ i)))))))
'ok)))
+(ert-deftest compat-call-alist-get-gv ()
+ "Test if the `compat-call alist-get' can be used as a generalised variable."
+ (let ((alist-1 (list (cons 1 "one")
+ (cons 2 "two")
+ (cons 3 "three")))
+ (alist-2 (list (cons "one" 1)
+ (cons "two" 2)
+ (cons "three" 3))))
+ (setf (compat-call alist-get 1 alist-1) "eins")
+ (should (equal (compat-call alist-get 1 alist-1) "eins"))
+ (setf (compat-call alist-get 2 alist-1 nil 'remove) nil)
+ (should (equal alist-1 '((1 . "eins") (3 . "three"))))
+ (setf (compat-call alist-get "one" alist-2 nil nil #'string=) "eins")
+ (should (equal (compat-call alist-get "one" alist-2 nil nil #'string=)
+ "eins"))))
+
+(ert-deftest compat-alist-get-gv ()
+ "Test if the `compat-alist-get' can be used as a generalised variable."
+ (let ((alist-1 (list (cons 1 "one")
+ (cons 2 "two")
+ (cons 3 "three")))
+ (alist-2 (list (cons "one" 1)
+ (cons "two" 2)
+ (cons "three" 3))))
+ (setf (compat-alist-get 1 alist-1) "eins")
+ (should (equal (compat-alist-get 1 alist-1) "eins"))
+ (setf (compat-alist-get 2 alist-1 nil 'remove) nil)
+ (should (equal alist-1 '((1 . "eins") (3 . "three"))))
+ (setf (compat-alist-get "one" alist-2 nil nil #'string=) "eins")
+ (should (equal (compat-alist-get "one" alist-2 nil nil #'string=)
+ "eins"))))
+
;; (defun compat--ought (name compat)
;; "Implementation for the `ought' macro for NAME.
;; COMPAT is the name of the compatibility function the behaviour is
@@ -677,38 +709,6 @@
;; (ought 'd 0 '((1 . a) (2 . b) (3 . c)) 'd) ;default value
;; (ought 'd 2 '((1 . a) (2 . b) (3 . c)) 'd nil #'ignore))
-;; (ert-deftest compat-call-alist-get-gv ()
-;; "Test if the `compat-call alist-get' can be used as a generalised
variable."
-;; (let ((alist-1 (list (cons 1 "one")
-;; (cons 2 "two")
-;; (cons 3 "three")))
-;; (alist-2 (list (cons "one" 1)
-;; (cons "two" 2)
-;; (cons "three" 3))))
-;; (setf (compat-call alist-get 1 alist-1) "eins")
-;; (should (equal (compat-call alist-get 1 alist-1) "eins"))
-;; (setf (compat-call alist-get 2 alist-1 nil 'remove) nil)
-;; (should (equal alist-1 '((1 . "eins") (3 . "three"))))
-;; (setf (compat-call alist-get "one" alist-2 nil nil #'string=) "eins")
-;; (should (equal (compat-call alist-get "one" alist-2 nil nil #'string=)
-;; "eins"))))
-
-;; (ert-deftest compat-alist-get-gv ()
-;; "Test if the `compat-alist-get' can be used as a generalised variable."
-;; (let ((alist-1 (list (cons 1 "one")
-;; (cons 2 "two")
-;; (cons 3 "three")))
-;; (alist-2 (list (cons "one" 1)
-;; (cons "two" 2)
-;; (cons "three" 3))))
-;; (setf (compat-alist-get 1 alist-1) "eins")
-;; (should (equal (compat-alist-get 1 alist-1) "eins"))
-;; (setf (compat-alist-get 2 alist-1 nil 'remove) nil)
-;; (should (equal alist-1 '((1 . "eins") (3 . "three"))))
-;; (setf (compat-alist-get "one" alist-2 nil nil #'string=) "eins")
-;; (should (equal (compat-alist-get "one" alist-2 nil nil #'string=)
-;; "eins"))))
-
;; (compat-deftests string-trim-left
;; (ought "" "") ;empty string
;; (ought "a" "a") ;"full" string