aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTom Tromey2017-02-05 11:40:18 -0700
committerTom Tromey2017-02-11 12:30:32 -0700
commit862d6438cfa6c6c035033697751f3d002357b024 (patch)
treecc7eab8482c2fe5fabb37660d1d5a6353aefd159 /test
parentc2e19a73401eb37d5c13f6c8589dc1e5d706d239 (diff)
downloademacs-862d6438cfa6c6c035033697751f3d002357b024.tar.gz
emacs-862d6438cfa6c6c035033697751f3d002357b024.zip
Recognize JS regexp literals more correctly
Bug#25529 * lisp/progmodes/js.el (js--syntax-propertize-regexp-regexp): New constant. (js-syntax-propertize-regexp): Use it. Remove "end" argument. (js--syntax-propertize-regexp-syntax-table): Remove. (js-syntax-propertize): Update. * test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax-bug-25529): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/js-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index 7cb737c30e2..d61f084e0df 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -23,6 +23,7 @@
23 23
24(require 'ert) 24(require 'ert)
25(require 'js) 25(require 'js)
26(require 'syntax)
26 27
27(ert-deftest js-mode-fill-bug-19399 () 28(ert-deftest js-mode-fill-bug-19399 ()
28 (with-temp-buffer 29 (with-temp-buffer
@@ -99,6 +100,22 @@ if (!/[ (:,='\"]/.test(value)) {
99 (forward-line) 100 (forward-line)
100 (should (looking-at " \\* test")))) 101 (should (looking-at " \\* test"))))
101 102
103(ert-deftest js-mode-regexp-syntax-bug-25529 ()
104 (dolist (regexp-contents '("[^[]"
105 "[/]"
106 ;; A comment with the regexp on the next
107 ;; line.
108 "*comment*/\n/regexp"))
109 (with-temp-buffer
110 (js-mode)
111 (insert "let x = /" regexp-contents "/;\n")
112 (save-excursion (insert "something();\n"))
113 ;; The failure mode was that the regexp literal was not
114 ;; recognized, causing the next line to be given string syntax;
115 ;; but check for comment syntax as well to prevent an
116 ;; implementation not recognizing the comment example.
117 (should-not (syntax-ppss-context (syntax-ppss))))))
118
102(provide 'js-tests) 119(provide 'js-tests)
103 120
104;;; js-tests.el ends here 121;;; js-tests.el ends here