about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-07-30T14·22-0700
committerclbot <clbot@tvl.fyi>2022-07-30T14·25+0000
commit5c99ba9702a5a1e6e1d5b68e1e4e1cb2e3b96990 (patch)
tree2fc83d95c943cdf762bf71b5a8a97fbfc368f31f
parent6686c6d693acd340094370889a8381e793e76933 (diff)
fix(wpcarro/emacs): Use should macro in set.el tests r/4356
Uncovered a few misconfigured tests by consuming the `should` macro.

Change-Id: Ie0204818ecf1f6f5a0feafa85e4e100fb91b8865
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6011
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
-rw-r--r--users/wpcarro/emacs/pkgs/set/tests.el89
1 files changed, 40 insertions, 49 deletions
diff --git a/users/wpcarro/emacs/pkgs/set/tests.el b/users/wpcarro/emacs/pkgs/set/tests.el
index 3544364897..7f5c2ae3ff 100644
--- a/users/wpcarro/emacs/pkgs/set/tests.el
+++ b/users/wpcarro/emacs/pkgs/set/tests.el
@@ -11,68 +11,59 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (ert-deftest set-from-list ()
-  (equal '(1 2 3)
-         (->> '(1 2 3 1 2 3)
-              set-from-list
-              set-to-list)))
+  (should (equal '(1 2 3)
+                 (->> '(1 2 3 1 2 3)
+                      set-from-list
+                      set-to-list))))
 
 (ert-deftest set-distinct? ()
-  (and
-   (set-distinct? (set-new 'one 'two 'three)
-                  (set-new 'a 'b 'c))
-   (not
-    (set-distinct? (set-new 1 2 3)
-                   (set-new 3 4 5)))
-   (not
-    (set-distinct? (set-new 1 2 3)
-                   (set-new 1 2 3)))))
+  (should (set-distinct? (set-new 'one 'two 'three)
+                         (set-new 'a 'b 'c)))
+  (should (not
+           (set-distinct? (set-new 1 2 3)
+                          (set-new 3 4 5))))
+  (should (not
+           (set-distinct? (set-new 1 2 3)
+                          (set-new 1 2 3)))))
 
 (ert-deftest set-equal? ()
-  (and
-   (set-equal? (set-new 'a 'b 'c)
-               (set-new 'x 'y 'z))
-   (set-equal? (set-new 'a 'b 'c)
-               (set-new 'a 'b))
-   (set-equal? (set-new 'a 'b 'c)
-               (set-new 'a 'b 'c))))
+  (should (not (set-equal? (set-new 'a 'b 'c)
+                           (set-new 'x 'y 'z))))
+  (should (not (set-equal? (set-new 'a 'b 'c)
+                           (set-new 'a 'b))))
+  (should (set-equal? (set-new 'a 'b 'c)
+                      (set-new 'a 'b 'c))))
 
 (ert-deftest set-intersection ()
-  (set-equal? (set-new 2 3)
-              (set-intersection (set-new 1 2 3)
-                                (set-new 2 3 4))))
+  (should (set-equal? (set-new 2 3)
+                      (set-intersection (set-new 1 2 3)
+                                        (set-new 2 3 4)))))
 
 (ert-deftest set-to/from-list ()
-  (equal '(1 2 3)
-         (->> '(1 1 2 2 3 3)
-              set-from-list
-              set-to-list)))
+  (should (equal '(1 2 3)
+                 (->> '(1 1 2 2 3 3)
+                      set-from-list
+                      set-to-list))))
 
 (ert-deftest set-subset? ()
-  (let ((primary-colors (set-new "red" "green" "blue")))
-    ;; set-subset?
-    (and
-     (set-subset? (set-new "black" "grey")
-                  primary-colors)
-     (set-subset? (set-new "red")
-                  primary-colors))))
+  (should (not (set-subset? (set-new "black" "grey")
+                            (set-new "red" "green" "blue"))))
+  (should (set-subset? (set-new "red")
+                       (set-new "red" "green" "blue"))))
 
-(ert-deftest set-subset/superset? ()
+(ert-deftest set-superset? ()
   (let ((primary-colors (set-new "red" "green" "blue")))
-    ;; set-subset?
-    (and
-     (not (set-superset? primary-colors
-                         (set-new "black" "grey")))
-     (set-superset? primary-colors
-                    (set-new "red" "green" "blue"))
-     (set-superset? primary-colors
-                    (set-new "red" "blue")))))
+    (should (not (set-superset? primary-colors
+                                (set-new "black" "grey"))))
+    (should (set-superset? primary-colors
+                           (set-new "red" "green" "blue")))
+    (should (set-superset? primary-colors
+                           (set-new "red" "blue")))))
 
 (ert-deftest set-empty? ()
-  (and
-   (set-empty? (set-new))
-   (set-empty? (set-new 1 2 3))))
+  (should (set-empty? (set-new)))
+  (should (not (set-empty? (set-new 1 2 3)))))
 
 (ert-deftest set-count ()
-  (and
-   (= 0 (set-count (set-new)))
-   (= 2 (set-count (set-new 1 1 2 2)))))
+  (should (= 0 (set-count (set-new))))
+  (should (= 2 (set-count (set-new 1 1 2 2)))))