aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTom Tromey2017-03-13 21:53:59 +0100
committerTom Tromey2017-04-01 15:03:46 -0600
commitf4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51 (patch)
treef5cdc92819df4b3e7994f369dc81657ee0bb0692 /test
parentac2ca82eb19bbf7f1cac7ec3f6c020ebf2b15882 (diff)
downloademacs-f4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51.tar.gz
emacs-f4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51.zip
fix two js-mode syntax propertization bugs
Bug#26070: * lisp/progmodes/js.el (js--syntax-propertize-regexp-regexp): Add zero-or-one to regular expression. (js-syntax-propertize-regexp): Update. Propertize body of regexp literal up to END. * test/lisp/progmodes/js-tests.el (js-mode-propertize-bug-1) (js-mode-propertize-bug-2): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/js-tests.el37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index e030675e07c..8e1bac10cd1 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) {
140 (font-lock-ensure) 140 (font-lock-ensure)
141 (should (eq (get-text-property (point) 'face) (caddr test)))))) 141 (should (eq (get-text-property (point) 'face) (caddr test))))))
142 142
143(ert-deftest js-mode-propertize-bug-1 ()
144 (with-temp-buffer
145 (js-mode)
146 (save-excursion (insert "x"))
147 (insert "/")
148 ;; The bug was a hang.
149 (should t)))
150
151(ert-deftest js-mode-propertize-bug-2 ()
152 (with-temp-buffer
153 (js-mode)
154 (insert "function f() {
155 function g()
156 {
157 1 / 2;
158 }
159
160 function h() {
161")
162 (save-excursion
163 (insert "
164 00000000000000000000000000000000000000000000000000;
165 00000000000000000000000000000000000000000000000000;
166 00000000000000000000000000000000000000000000000000;
167 00000000000000000000000000000000000000000000000000;
168 00000000000000000000000000000000000000000000000000;
169 00000000000000000000000000000000000000000000000000;
170 00000000000000000000000000000000000000000000000000;
171 00000000000000000000000000000000000000000000000000;
172 00;
173 }
174}
175"))
176 (insert "/")
177 ;; The bug was a hang.
178 (should t)))
179
143(provide 'js-tests) 180(provide 'js-tests)
144 181
145;;; js-tests.el ends here 182;;; js-tests.el ends here