aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Oliver2024-11-07 19:22:21 +0000
committerHarald Jörg2025-01-13 17:07:51 +0100
commit1fd7957bc72b766ef8d2ddfc4858f714ee0814c0 (patch)
tree4f0673174d52bf26732807cd8ab0b12ac83d5de4
parent8d289670d601ab89a5baf62de7a8b8c0ed31deda (diff)
downloademacs-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.pl16
-rw-r--r--test/lisp/progmodes/cperl-mode-tests.el9
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 -------
5package P {
6use v5.36;
7sub ignore ($first, $) {}
8ignore(qw(first second));
9}
10# -------- signature where last parameter is ignored: expected output -------
11package 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.
1594It 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