[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/macrostep d48e52b 101/110: Add tests for compiler-macro ex
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/macrostep d48e52b 101/110: Add tests for compiler-macro expansion |
Date: |
Sat, 7 Aug 2021 09:18:11 -0400 (EDT) |
branch: elpa/macrostep
commit d48e52bd1fc862ee5160de23cf1b97f931dc0b67
Author: joddie <jonxfield@gmail.com>
Commit: joddie <jonxfield@gmail.com>
Add tests for compiler-macro expansion
---
macrostep-test.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 3 deletions(-)
diff --git a/macrostep-test.el b/macrostep-test.el
index 7ef1bf3..a3189b0 100644
--- a/macrostep-test.el
+++ b/macrostep-test.el
@@ -46,7 +46,7 @@
(re-search-forward (regexp-quote text))
(goto-char (match-beginning 0))))
-(defmacro macrostep-should-expand (form expansion)
+(defmacro macrostep-should-expand (form expansion &optional leave-expanded-p)
`(save-excursion
(goto-char (point-min))
(let ((print-level nil)
@@ -59,7 +59,8 @@
(should
(equal (read (current-buffer))
,expansion)))
- (macrostep-collapse-all)))))
+ (unless ,leave-expanded-p
+ (macrostep-collapse-all))))))
;;;; Tests
@@ -187,7 +188,7 @@
'(test-macro (second (call)))
'(inner-definition (second (call))))))
-(ert-deftest macrostep-environnment-at-point ()
+(ert-deftest macrostep-environment-at-point ()
(macrostep-with-text
;; Taken from org-notify.el.
'(cl-macrolet ((get (k) `(plist-get list ,k))
@@ -344,6 +345,52 @@
(should (equal (read (copy-marker (point)))
'(dummy-macro-2 (some (arguments)))))))))
+(ert-deftest macrostep-expand-compiler-macros ()
+ "Test that compiler-macros are expanded"
+ ;; definitions
+ (defun macrostep-dummy-function (&rest args)
+ args)
+ (cl-define-compiler-macro macrostep-dummy-function (&rest args)
+ `(compile-time expansion of ,@args))
+
+ (macrostep-with-text
+ '(progn
+ (first body form)
+ (macrostep-dummy-function first second third)
+ (remaining body forms))
+ (macrostep-should-expand
+ '(macrostep-dummy-function first second third)
+ '(compile-time expansion of first second third))))
+
+(ert-deftest macrostep-fontify-compiler-macros ()
+ "Test that compiler-macros are fontified in macro-expansions"
+ ;; definitions
+ (defmacro macrostep-dummy-macro (&rest args)
+ `(expansion including (macrostep-dummy-function ,@args)))
+ (defun macrostep-dummy-function (&rest args)
+ args)
+ (cl-define-compiler-macro macrostep-dummy-4 (&rest args)
+ `(compile-time expansion of ,@args))
+
+ (macrostep-with-text
+ '(progn
+ (first body form)
+ (second body form)
+ (macrostep-dummy-macro first second third)
+ (remaining body forms))
+ (macrostep-should-expand
+ '(macrostep-dummy-macro first second third)
+ '(expansion including (macrostep-dummy-function first second third))
+ t)
+ (macrostep-goto "(macrostep-dummy-function")
+ (should
+ (eq (get-char-property (1+ (point)) 'font-lock-face)
+ 'macrostep-compiler-macro-face))
+
+ (macrostep-should-expand
+ '(macrostep-dummy-function first second third)
+ '(compile-time expansion of first second third))))
+
;;;; Tests for C macro expansion
- [nongnu] elpa/macrostep aa40d97 076/110: Test expansion within Elisp macro-defining macros, (continued)
- [nongnu] elpa/macrostep aa40d97 076/110: Test expansion within Elisp macro-defining macros, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 1edee85 080/110: Reorganise and comment, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep bbfb033 081/110: Reorganise and document generic interface, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 2bdc946 082/110: Remove dynamic binding of `macrostep-environment'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 31a23eb 085/110: Toggle separate-buffer expansion with prefix (#8), ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 47cbacb 087/110: Define `macrostep-propertize` before using it, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep a8e730e 089/110: Improve Makefile, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 2473a6f 094/110: Pass START and END args to sexp-at-point-function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 03d4d7b 096/110: Add basic C macro expansion via cmacexp.el, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 9a6b04a 100/110: Restore Emacs 23 compatibility, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep d48e52b 101/110: Add tests for compiler-macro expansion,
ELPA Syncer <=
- [nongnu] elpa/macrostep aa59895 103/110: Add .travis.yml, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 7b2c1f3 108/110: Load all autoloaded macros, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 4d75baf 003/110: Bump version number, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 8a85acc 022/110: Refactor backquote handling and text properties., ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 2d216ba 109/110: Merge pull request #19 from fice-t/autoload, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 83b2a0a 015/110: Tweak visible highlight, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 3f815fb 031/110: Test for normal defmacro expansion, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 9d2c58c 040/110: Add option to expand in a separate buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 3f965b0 048/110: Use new `macrostep-macro-start` text property, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep ff3888f 065/110: Use a form-tracking stream rather than gensym substitution, ELPA Syncer, 2021/08/07