summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-02-24 00:24:17 -0700
committerTom Tromey <tom@tromey.com>2017-02-24 20:33:41 -0700
commite52287ca3e974ed9f658315288060f638081abb0 (patch)
tree5c4f57067ae60c95a45bff71edeae03efe18f604 /test/lisp
parent7b49bd44b70d0583e7e5989513b38e6f77e1c559 (diff)
downloademacs-e52287ca3e974ed9f658315288060f638081abb0.tar.gz
Fix indentation error in js.el
* lisp/progmodes/js.el (js--indent-in-array-comp): Wrap forward-sexp call in condition-case. * test/lisp/progmodes/js-tests.el (js-mode-indentation-error): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/progmodes/js-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index 99f5898525b..07e659af605 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -118,6 +118,16 @@ if (!/[ (:,='\"]/.test(value)) {
;; implementation not recognizing the comment example.
(should-not (syntax-ppss-context (syntax-ppss))))))
+(ert-deftest js-mode-indentation-error ()
+ (with-temp-buffer
+ (js-mode)
+ ;; The bug previously was that requesting re-indentation on the
+ ;; "{" line here threw an exception.
+ (insert "const TESTS = [\n{")
+ (js-indent-line)
+ ;; Any success is ok here.
+ (should t)))
+
(provide 'js-tests)
;;; js-tests.el ends here