diff options
| author | Mauro Aranda | 2022-10-20 08:41:42 -0300 |
|---|---|---|
| committer | Stefan Kangas | 2023-09-07 00:13:53 +0200 |
| commit | 2a8f458719a622487a136162c1dc7b015bd427e3 (patch) | |
| tree | 1d567810091c31374ac578af5defbb9f9f72f449 /test | |
| parent | dd2053e8cd3050791bd236d0c1ff5f370170c903 (diff) | |
| download | emacs-2a8f458719a622487a136162c1dc7b015bd427e3.tar.gz emacs-2a8f458719a622487a136162c1dc7b015bd427e3.zip | |
Fix perl-mode indentation after a hanging paren
* lisp/progmodes/perl-mode.el (perl-hanging-paren-p): Allow
comments. (Bug#34245)
* test/lisp/progmodes/perl-mode-tests.el (perl-test-bug-34245): New
test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/perl-mode-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/progmodes/perl-mode-tests.el b/test/lisp/progmodes/perl-mode-tests.el index 3757ac25547..a47a6722e20 100644 --- a/test/lisp/progmodes/perl-mode-tests.el +++ b/test/lisp/progmodes/perl-mode-tests.el | |||
| @@ -28,6 +28,23 @@ | |||
| 28 | (font-lock-ensure (point-min) (point-max)) | 28 | (font-lock-ensure (point-min) (point-max)) |
| 29 | (should (equal (get-text-property 4 'face) 'font-lock-variable-name-face)))) | 29 | (should (equal (get-text-property 4 'face) 'font-lock-variable-name-face)))) |
| 30 | 30 | ||
| 31 | (ert-deftest perl-test-bug-34245 () | ||
| 32 | "Test correct indentation after a hanging paren, with and without comments." | ||
| 33 | (with-temp-buffer | ||
| 34 | (perl-mode) | ||
| 35 | (insert "my @foo = (\n\"bar\",\n\"baz\",\n);") | ||
| 36 | (insert "\n\n") | ||
| 37 | (insert "my @ofoo = (\t\t# A comment.\n\"obar\",\n\"obaz\",\n);") | ||
| 38 | (indent-region (point-min) (point-max)) | ||
| 39 | (goto-char (point-min)) | ||
| 40 | (forward-line) | ||
| 41 | (skip-chars-forward " \t") | ||
| 42 | (should (equal (current-column) perl-indent-level)) | ||
| 43 | (search-forward "# A comment.") | ||
| 44 | (forward-line) | ||
| 45 | (skip-chars-forward " \t") | ||
| 46 | (should (equal (current-column) perl-indent-level)))) | ||
| 47 | |||
| 31 | ;;;; Re-use cperl-mode tests | 48 | ;;;; Re-use cperl-mode tests |
| 32 | 49 | ||
| 33 | (defvar cperl-test-mode) | 50 | (defvar cperl-test-mode) |