emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/buttercup d3cd12a 019/340: Tests for the buttercup-describ


From: ELPA Syncer
Subject: [nongnu] elpa/buttercup d3cd12a 019/340: Tests for the buttercup-describe function
Date: Thu, 16 Dec 2021 14:58:56 -0500 (EST)

branch: elpa/buttercup
commit d3cd12add2f6dc2caea15e09a9c1d2aba8239e03
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>

    Tests for the buttercup-describe function
---
 buttercup-test.el | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/buttercup-test.el b/buttercup-test.el
index 27c797f..d6e43b2 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -151,3 +151,38 @@
     (expect (macroexpand '(describe "description" (+ 1 1)))
             :to-equal
             '(buttercup-describe "description" (lambda () (+ 1 1))))))
+
+(describe "The `buttercup-describe' function"
+  (it "should run the enclosing body"
+    (let ((it-ran nil))
+      (buttercup-describe "foo" (lambda () (setq it-ran t)))
+      (expect it-ran)))
+
+  (it "should set the `buttercup-suites' variable"
+    (let ((buttercup-suites nil)
+          (description "test to set global value"))
+      (buttercup-describe description (lambda () nil))
+      (expect (buttercup-suite-description (car buttercup-suites))
+              :to-equal
+              description)))
+
+  (it "should add child suites when called nested"
+    (let ((buttercup-suites nil)
+          (desc1 "description1")
+          (desc2 "description2"))
+
+      (buttercup-describe
+       desc1
+       (lambda ()
+         (buttercup-describe
+          desc2
+          (lambda () nil))))
+
+      (expect (buttercup-suite-description (car buttercup-suites))
+              :to-equal
+              desc1)
+      (let ((child-suite (car (buttercup-suite-children
+                               (car buttercup-suites)))))
+        (expect (buttercup-suite-description child-suite)
+                :to-equal
+                desc2)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]