aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorTom Tromey2017-01-16 14:02:45 -0700
committerTom Tromey2017-01-17 15:33:20 -0700
commitaa711e0a92c30914e1c68cf39251638d4faee22d (patch)
tree0933e5bee8a5544e639854ea2f181cee3f2f9081 /test/lisp
parent14c7d3a6e0581fd26254cd316fd369c9c3651146 (diff)
downloademacs-aa711e0a92c30914e1c68cf39251638d4faee22d.tar.gz
emacs-aa711e0a92c30914e1c68cf39251638d4faee22d.zip
Fix JS regexp literal syntax propertization in expressions
Bug#25465: * lisp/progmodes/js.el (js-syntax-propertize): Recognize a regexp literal after "!", "&", and "|". test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/progmodes/js-tests.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index 9bf7258eebe..84749efa45b 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -59,6 +59,32 @@
59 * Load the inspector's shared head.js for use by tests that need to 59 * Load the inspector's shared head.js for use by tests that need to
60 * open the something or other")))) 60 * open the something or other"))))
61 61
62(ert-deftest js-mode-regexp-syntax ()
63 (with-temp-buffer
64 ;; Normally indentation tests are done in manual/indent, but in
65 ;; this case we are specifically testing a case where the bug
66 ;; caused the indenter not to do anything, and manual/indent can
67 ;; only be used for already-correct files.
68 (insert "function f(start, value) {
69if (start - 1 === 0 || /[ (:,='\"]/.test(value)) {
70--start;
71}
72if (start - 1 === 0 && /[ (:,='\"]/.test(value)) {
73--start;
74}
75if (!/[ (:,='\"]/.test(value)) {
76--start;
77}
78}
79")
80 (js-mode)
81 (indent-region (point-min) (point-max))
82 (goto-char (point-min))
83 (dolist (x '(0 4 8 4 4 8 4 4 8 4 0))
84 (back-to-indentation)
85 (should (= (current-column) x))
86 (forward-line))))
87
62(provide 'js-tests) 88(provide 'js-tests)
63 89
64;;; js-tests.el ends here 90;;; js-tests.el ends here