summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2016-08-21 22:58:37 -0400
committerNoam Postavsky <npostavs@gmail.com>2016-12-06 22:20:23 -0500
commit58e418d2ceb82501f03d9c3316fd0a46faf7f0eb (patch)
tree699bd17367bc6fa8e8f244be5d040195250ff9ad /lisp/emacs-lisp
parent5202cb56add070eb7d9fe8015f2a4edd57a628f9 (diff)
downloademacs-58e418d2ceb82501f03d9c3316fd0a46faf7f0eb.tar.gz
emacs-58e418d2ceb82501f03d9c3316fd0a46faf7f0eb.tar.bz2
emacs-58e418d2ceb82501f03d9c3316fd0a46faf7f0eb.zip
Fix ert-tests when running compiled
* test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest): Don't test for specific macroexpansion, just check result of evaluation. (ert-test-record-backtrace): Don't hardcode representation of closure in expected backtrace, this lets the test succeed even when the test code is compiled. * lisp/emacs-lisp/ert.el (ert--expand-should-1): Also pass `byte-compile-macro-environment' to `macroexpand', this allows the `should' macro to properly handle macroexpansion of macros that were defined in the same file when it's being compiled (Bug #17851).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/ert.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 0308c9cd37c..89f83ddff43 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -276,11 +276,12 @@ DATA is displayed to the user and should state the reason for skipping."
(defun ert--expand-should-1 (whole form inner-expander)
"Helper function for the `should' macro and its variants."
(let ((form
- (macroexpand form (cond
- ((boundp 'macroexpand-all-environment)
- macroexpand-all-environment)
- ((boundp 'cl-macro-environment)
- cl-macro-environment)))))
+ (macroexpand form (append byte-compile-macro-environment
+ (cond
+ ((boundp 'macroexpand-all-environment)
+ macroexpand-all-environment)
+ ((boundp 'cl-macro-environment)
+ cl-macro-environment))))))
(cond
((or (atom form) (ert--special-operator-p (car form)))
(let ((value (cl-gensym "value-")))