summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/js-tests.el
diff options
context:
space:
mode:
authorVibhav Pant <vibhavp@gmail.com>2017-01-30 18:35:43 +0530
committerVibhav Pant <vibhavp@gmail.com>2017-01-30 18:35:43 +0530
commitbf7f7c0d82a56ed1b76358657e74ca2833b19fe2 (patch)
tree90f357b4a735ca7c90d1881ef9948186b9f919df /test/lisp/progmodes/js-tests.el
parent25d38a06eceb0853190a2d9acf53d85686f524bd (diff)
parent9c4dfdd1af9f97c6a8d7e922b68a39052116790c (diff)
downloademacs-bf7f7c0d82a56ed1b76358657e74ca2833b19fe2.tar.gz
emacs-bf7f7c0d82a56ed1b76358657e74ca2833b19fe2.tar.bz2
emacs-bf7f7c0d82a56ed1b76358657e74ca2833b19fe2.zip
Merge remote-tracking branch 'origin/master' into feature/byte-switch
Diffstat (limited to 'test/lisp/progmodes/js-tests.el')
-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 @@
* Load the inspector's shared head.js for use by tests that need to
* open the something or other"))))
+(ert-deftest js-mode-regexp-syntax ()
+ (with-temp-buffer
+ ;; Normally indentation tests are done in manual/indent, but in
+ ;; this case we are specifically testing a case where the bug
+ ;; caused the indenter not to do anything, and manual/indent can
+ ;; only be used for already-correct files.
+ (insert "function f(start, value) {
+if (start - 1 === 0 || /[ (:,='\"]/.test(value)) {
+--start;
+}
+if (start - 1 === 0 && /[ (:,='\"]/.test(value)) {
+--start;
+}
+if (!/[ (:,='\"]/.test(value)) {
+--start;
+}
+}
+")
+ (js-mode)
+ (indent-region (point-min) (point-max))
+ (goto-char (point-min))
+ (dolist (x '(0 4 8 4 4 8 4 4 8 4 0))
+ (back-to-indentation)
+ (should (= (current-column) x))
+ (forward-line))))
+
(provide 'js-tests)
;;; js-tests.el ends here