branch: externals/js2-mode
commit e8bbfd204bfa34571b58b21b7ad7eb378e627037
Merge: 61a8c91 997d6bd
Author: Dmitry Gutov <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #551 from phst/let
Avoid undefined behavior in indentation tests.
---
tests/indent.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/tests/indent.el b/tests/indent.el
index 0924691..57db7cf 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -39,11 +39,14 @@
(cl-defmacro js2-deftest-indent (name content &key bind keep-indent)
`(ert-deftest ,(intern (format "js2-%s" name)) ()
- (let ,(append '(indent-tabs-mode
- (js2-basic-offset 2)
- (js2-pretty-multiline-declarations t)
- (inhibit-point-motion-hooks t))
- bind)
+ ;; We use ‘let*’ instead of ‘let’ in case a binding in BIND overwrites one
+ ;; of the outer bindings. See the note about duplicate bindings in the
+ ;; Info node ‘(elisp) Local Variables’.
+ (let* ,(append '(indent-tabs-mode
+ (js2-basic-offset 2)
+ (js2-pretty-multiline-declarations t)
+ (inhibit-point-motion-hooks t))
+ bind)
(js2-test-indent ,content ,keep-indent))))
(put 'js2-deftest-indent 'lisp-indent-function 'defun)