1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Tom Tromey 2017-03-13 21:53:59 +01:00
parent ac2ca82eb1
commit f4ecb65f33
2 changed files with 44 additions and 6 deletions

View file

@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) {
(font-lock-ensure)
(should (eq (get-text-property (point) 'face) (caddr test))))))
(ert-deftest js-mode-propertize-bug-1 ()
(with-temp-buffer
(js-mode)
(save-excursion (insert "x"))
(insert "/")
;; The bug was a hang.
(should t)))
(ert-deftest js-mode-propertize-bug-2 ()
(with-temp-buffer
(js-mode)
(insert "function f() {
function g()
{
1 / 2;
}
function h() {
")
(save-excursion
(insert "
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00000000000000000000000000000000000000000000000000;
00;
}
}
"))
(insert "/")
;; The bug was a hang.
(should t)))
(provide 'js-tests)
;;; js-tests.el ends here