summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2019-04-29 09:08:19 -0700
committerGlenn Morris <rgm@gnu.org>2019-04-29 09:08:19 -0700
commit666293861985480bc658f9fa399009027bc39f1e (patch)
treecbab6e4c77be3e5ee965b0e15b681b1030f2c3bb /test
parentf1a3a7d6caeb3f250d338217dfd4c476e812bc6e (diff)
parent0e8d452c1c166ff65a0325de23bc04b57aea68d8 (diff)
downloademacs-666293861985480bc658f9fa399009027bc39f1e.tar.gz
Merge from origin/emacs-26
0e8d452 ; * doc/lispref/nonascii.texi (Coding System Basics): Fix gra... 25a2ff7 ; Add missing space in custom.texi 9ec18fb * admin/admin.el (set-version): Check for increase in version... 93912ba Be more careful about indent-sexp going over eol (Bug#35286)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el
index a6370742ab4..63632449ca5 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -136,6 +136,34 @@ noindent\" 3
(indent-sexp)
(should (equal (buffer-string) "(())"))))
+(ert-deftest indent-sexp-stop-before-eol-comment ()
+ "`indent-sexp' shouldn't look for more sexps after an eol comment."
+ ;; See https://debbugs.gnu.org/35286.
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (let ((str "() ;;\n x"))
+ (insert str)
+ (goto-char (point-min))
+ (indent-sexp)
+ ;; The "x" is in the next sexp, so it shouldn't get indented.
+ (should (equal (buffer-string) str)))))
+
+(ert-deftest indent-sexp-stop-before-eol-non-lisp ()
+ "`indent-sexp' shouldn't be too agressive in non-Lisp modes."
+ ;; See https://debbugs.gnu.org/35286#13.
+ (with-temp-buffer
+ (prolog-mode)
+ (let ((str "\
+x(H) -->
+ {y(H)}.
+a(A) -->
+ b(A)."))
+ (insert str)
+ (search-backward "{")
+ (indent-sexp)
+ ;; There's no line-spanning sexp, so nothing should be indented.
+ (should (equal (buffer-string) str)))))
+
(ert-deftest lisp-indent-region ()
"Test basics of `lisp-indent-region'."
(with-temp-buffer