diff options
| author | Peter Oliver | 2024-11-07 19:22:21 +0000 |
|---|---|---|
| committer | Harald Jörg | 2025-01-13 17:07:51 +0100 |
| commit | 1fd7957bc72b766ef8d2ddfc4858f714ee0814c0 (patch) | |
| tree | 4f0673174d52bf26732807cd8ab0b12ac83d5de4 | |
| parent | 8d289670d601ab89a5baf62de7a8b8c0ed31deda (diff) | |
| download | emacs-1fd7957bc72b766ef8d2ddfc4858f714ee0814c0.tar.gz emacs-1fd7957bc72b766ef8d2ddfc4858f714ee0814c0.zip | |
; cperl-mode.el: Add a test for Bug#74245
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl: New test data.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-74245): Verify
that a bare \"$\" can appear at the end of a subroutine signature.
| -rw-r--r-- | test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl | 16 | ||||
| -rw-r--r-- | test/lisp/progmodes/cperl-mode-tests.el | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl new file mode 100644 index 00000000000..44d1e49bd36 --- /dev/null +++ b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | # This resource file can be run with cperl--run-testcases from | ||
| 2 | # cperl-tests.el and works with both perl-mode and cperl-mode. | ||
| 3 | |||
| 4 | # -------- signature where last parameter is ignored: input ------- | ||
| 5 | package P { | ||
| 6 | use v5.36; | ||
| 7 | sub ignore ($first, $) {} | ||
| 8 | ignore(qw(first second)); | ||
| 9 | } | ||
| 10 | # -------- signature where last parameter is ignored: expected output ------- | ||
| 11 | package P { | ||
| 12 | use v5.36; | ||
| 13 | sub ignore ($first, $) {} | ||
| 14 | ignore(qw(first second)); | ||
| 15 | } | ||
| 16 | # -------- signature where last parameter is ignored: end ------- | ||
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 958ffe38a8b..e54790256ab 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el | |||
| @@ -1589,6 +1589,15 @@ and the slash, then we have a division." | |||
| 1589 | (should (equal (nth 8 (cperl-test-ppss code "/")) 9))) | 1589 | (should (equal (nth 8 (cperl-test-ppss code "/")) 9))) |
| 1590 | ) | 1590 | ) |
| 1591 | 1591 | ||
| 1592 | (ert-deftest cperl-test-bug-74245 () | ||
| 1593 | "Verify that a bare \"$\" can appear at the end of a subroutine signature. | ||
| 1594 | It must not be mistaken for \"$)\"." | ||
| 1595 | (cperl--run-test-cases | ||
| 1596 | (ert-resource-file "cperl-bug-74245.pl") | ||
| 1597 | (while (null (eobp)) | ||
| 1598 | (cperl-indent-command) | ||
| 1599 | (forward-line 1)))) | ||
| 1600 | |||
| 1592 | (ert-deftest test-indentation () | 1601 | (ert-deftest test-indentation () |
| 1593 | (ert-test-erts-file (ert-resource-file "cperl-indents.erts"))) | 1602 | (ert-test-erts-file (ert-resource-file "cperl-indents.erts"))) |
| 1594 | 1603 | ||