diff options
author | Harald Jörg <haj@posteo.de> | 2020-11-03 15:28:40 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-11-03 15:28:40 +0100 |
commit | 84f74136d374421d3eb6a71a2e248e2b369cddbe (patch) | |
tree | ee0ea3002e37c29cfde865dda1a00d3c34c29d83 /test/lisp/progmodes/cperl-mode-tests.el | |
parent | bd8f4b04d51083bd61350c70c09daff4fd8bb61d (diff) | |
download | emacs-84f74136d374421d3eb6a71a2e248e2b369cddbe.tar.gz emacs-84f74136d374421d3eb6a71a2e248e2b369cddbe.tar.bz2 emacs-84f74136d374421d3eb6a71a2e248e2b369cddbe.zip |
cperl-mode: Fix indentation for Emacs 26
* lisp/progmodes/cperl-mode.el (cperl-mode): Add a fix
which is only required for Emacs versions older than 27.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug30393):
Add a test to verify correct indentation (bug#30393).
Diffstat (limited to 'test/lisp/progmodes/cperl-mode-tests.el')
-rw-r--r-- | test/lisp/progmodes/cperl-mode-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index dcde3b68a03..2977f108131 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -220,6 +220,35 @@ point in the distant past, and is still broken in perl-mode. " (should (equal (nth 3 (syntax-ppss)) nil)) (should (equal (nth 4 (syntax-ppss)) t)))))) +(ert-deftest cperl-bug30393 () + "Verify that indentation is not disturbed by an open paren in col 0. +Perl is not Lisp: An open paren in column 0 does not start a function." + (let ((file (ert-resource-file "cperl-bug-30393.pl"))) + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-min)) + (while (re-search-forward + (concat "^# ?-+ \\_<\\(?1:.+?\\)\\_>: input ?-+\n" + "\\(?2:\\(?:.*\n\\)+?\\)" + "# ?-+ \\1: expected output ?-+\n" + "\\(?3:\\(?:.*\n\\)+?\\)" + "# ?-+ \\1: end ?-+") + nil t) + (let ((name (match-string 1)) + (code (match-string 2)) + (expected (match-string 3)) + got) + (with-temp-buffer + (insert code) + (funcall cperl-test-mode) + (goto-char (point-min)) + (while (null (eobp)) + (cperl-indent-command) + (next-line)) + (setq expected (concat "test case " name ":\n" expected)) + (setq got (concat "test case " name ":\n" (buffer-string))) + (should (equal got expected)))))))) + (ert-deftest cperl-bug37127 () "Verify that closing a paren in a regex goes without a message. Also check that the message is issued if the regex terminator is |