about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-07-30T14·13-0700
committerclbot <clbot@tvl.fyi>2022-07-30T14·16+0000
commit4193f24e5d7583f2b176cc35cac2e55319be528f (patch)
treea2a78ea73f08738b762c109ed2b440d500b91ded /users
parent3935848a5dffc5b5193feca267427671525cbaf3 (diff)
fix(wpcarro/emacs): Use should macro in al.el tests r/4354
:)

Change-Id: Idcd0e51737c4331b1c95fe2589f0758f443228ac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6009
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'users')
-rw-r--r--users/wpcarro/emacs/pkgs/al/tests.el54
1 files changed, 30 insertions, 24 deletions
diff --git a/users/wpcarro/emacs/pkgs/al/tests.el b/users/wpcarro/emacs/pkgs/al/tests.el
index 6556ddabc359..04fe4dcbb5a6 100644
--- a/users/wpcarro/emacs/pkgs/al/tests.el
+++ b/users/wpcarro/emacs/pkgs/al/tests.el
@@ -10,38 +10,44 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (ert-deftest al-has-key? ()
-  (and
-   (al-has-key? 'fname '((fname . "William")))
-   (not (al-has-key? 'lname '((fname . "William"))))))
+  (should (al-has-key? 'fname '((fname . "William"))))
+  (should (not (al-has-key? 'lname '((fname . "William"))))))
 
 (ert-deftest al-get ()
   (let ((xs (->> (al-new)
                  (al-set 'fname "John")
                  (al-set 'employed? nil))))
-    (and
-     (string= "John" (al-get 'fname xs))
-     (string= "Cleese" (al-get 'lname xs "Cleese"))
-     ;; Test that the value of nil is returned even when a default is defined,
-     ;; which could be a subtle bug in the typical Elisp pattern of supporting
-     ;; defaults with: (or foo default).
-     (eq nil (al-get 'employed? xs))
-     (eq nil (al-get 'employed? xs "default")))))
+    (should (string= "John" (al-get 'fname xs)))
+    (should (string= "Cleese" (al-get 'lname xs "Cleese")))
+    ;; Test that the value of nil is returned even when a default is defined,
+    ;; which could be a subtle bug in the typical Elisp pattern of supporting
+    ;; defaults with: (or foo default).
+    (should (eq nil (al-get 'employed? xs)))
+    (should (eq nil (al-get 'employed? xs "default")))))
 
 (ert-deftest al-has-value? ()
-  (and
-   (al-has-value? "William" '((fname . "William")))
-   (not (al-has-key? "John" '((fname . "William"))))))
+  (should (al-has-value? "William" '((fname . "William"))))
+  (should (not (al-has-key? "John" '((fname . "William"))))))
 
 (ert-deftest al-map-keys ()
-  (equal '((2 . one)
-           (3 . two))
-         (al-map-keys #'1+
-                      '((1 . one)
-                        (2 . two)))))
+  (should
+   (equal '((2 . one)
+            (3 . two))
+          (al-map-keys #'1+
+                       '((1 . one)
+                         (2 . two))))))
 
 (ert-deftest al-map-values ()
-  (equal '((one . 2)
-           (two . 3))
-         (al-map-values #'1+
-                        '((one . 1)
-                          (two . 2)))))
+  (should (equal '((one . 2)
+                   (two . 3))
+                 (al-map-values #'1+
+                                '((one . 1)
+                                  (two . 2))))))
+
+(ert-deftest al-delete ()
+  (let ((person (->> (al-new)
+                     (al-set "fname" "John")
+                     (al-set "lname" "Cleese")
+                     (al-set "age" 82))))
+    (should (al-has-key? "age" person))
+    (should (not (al-has-key? "age" (al-delete "age" person))))))