summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/cperl-mode-tests.el
diff options
context:
space:
mode:
authorHarald Jörg <haj@posteo.de>2021-06-09 22:58:53 +0200
committerHarald Jörg <haj@posteo.de>2021-06-09 23:04:09 +0200
commitdd9385b404c28a155a91960a4f1c4c77fdc5413d (patch)
treea03d86a4223aae3ad4aa63fb997d3ce11ea53c42 /test/lisp/progmodes/cperl-mode-tests.el
parentff65ea932cdcf69a3f5109327ec8e6a7e3432107 (diff)
downloademacs-dd9385b404c28a155a91960a4f1c4c77fdc5413d.tar.gz
emacs-dd9385b404c28a155a91960a4f1c4c77fdc5413d.tar.bz2
emacs-dd9385b404c28a155a91960a4f1c4c77fdc5413d.zip
; perl-mode.el: Detect quote-like operator immediately after =>
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Detect a quotelike operator immediately after a fat comma "=>" (Bug#25098) * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-25098): Test case for the bug with code from the bug report. * test/lisp/progmodes/cperl-mode-resources/cperl-bug-25098.pl: Resource file for the test.
Diffstat (limited to 'test/lisp/progmodes/cperl-mode-tests.el')
-rw-r--r--test/lisp/progmodes/cperl-mode-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el
index 036e20d7cca..dcf4f398c29 100644
--- a/test/lisp/progmodes/cperl-mode-tests.el
+++ b/test/lisp/progmodes/cperl-mode-tests.el
@@ -397,6 +397,24 @@ Regular expressions are strings in both perl-mode and cperl-mode."
(search-forward "RIGHT")
(should (nth 3 (syntax-ppss)))))
+(ert-deftest cperl-test-bug-25098 ()
+ "Verify that a quotelike operator is recognized after a fat comma \"=>\".
+Related, check that calling a method named q is not mistaken as a
+quotelike operator."
+ (with-temp-buffer
+ (insert-file-contents (ert-resource-file "cperl-bug-25098.pl"))
+ (funcall cperl-test-mode)
+ (goto-char (point-min))
+ ;; good example from the bug report, with a space
+ (search-forward "q{")
+ (should (nth 3 (syntax-ppss)))
+ ;; bad (but now fixed) example from the bug report, without space
+ (search-forward "q{")
+ (should (nth 3 (syntax-ppss)))
+ ;; calling a method "q" (parens instead of braces to make it valid)
+ (search-forward "q(")
+ (should-not (nth 3 (syntax-ppss)))))
+
(ert-deftest cperl-test-bug-28650 ()
"Verify that regular expressions are recognized after 'return'.
The test uses the syntax property \"inside a string\" for the