branch: elpa/macrostep
commit 07e14e2be801404a2ca89a763d44f21a6e41a106
Author: joddie <[email protected]>
Commit: joddie <[email protected]>

    Test for macrostep-environment-at-point
---
 macrostep-test.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/macrostep-test.el b/macrostep-test.el
index 70d3777..7fda05e 100644
--- a/macrostep-test.el
+++ b/macrostep-test.el
@@ -140,6 +140,27 @@
      '(test-macro (second (call)))
      '(inner-definition (second (call))))))
 
+(ert-deftest macrostep-environnment-at-point ()
+  (macrostep-with-text
+      ;; Taken from org-notify.el.
+      '(macrolet ((get (k) `(plist-get list ,k))
+                  (pr (k v) `(setq result (plist-put result ,k ,v))))
+        (body forms))
+    (search-forward "(body")
+    (let ((env (macrostep-environment-at-point)))
+      (should (assq 'get env))
+      (should (assq 'pr env))
+      (should (functionp (cdr (assq 'get env))))
+      (should (functionp (cdr (assq 'pr env))))
+      (should
+       (equal
+        (apply (cdr (assq 'pr env)) '(:heading heading))
+        '(setq result (plist-put result :heading heading))))
+      (should
+       (equal
+        (apply (cdr (assq 'get env)) '(:begin))
+        '(plist-get list :begin))))))
+
 (when noninteractive
   (load-file (expand-file-name "macrostep.el"
                                (file-name-directory load-file-name)))

Reply via email to