summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-03-13 21:53:59 +0100
committerTom Tromey <tom@tromey.com>2017-04-01 15:03:46 -0600
commitf4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51 (patch)
treef5cdc92819df4b3e7994f369dc81657ee0bb0692 /test
parentac2ca82eb19bbf7f1cac7ec3f6c020ebf2b15882 (diff)
downloademacs-f4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51.tar.gz
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)) {
(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