diff options
author | Harald Jörg <haj@posteo.de> | 2020-10-19 10:57:57 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-10-19 10:57:57 +0200 |
commit | fb26dc130db99cda4227257c10b9b8c38079b83f (patch) | |
tree | 7c559a44c38c0d31a0a371437a57b5e300549e5b /test/lisp/progmodes/cperl-mode-tests.el | |
parent | 422fdabe7bcaa9eac9aa5ae688ccf9f30cf6765c (diff) | |
download | emacs-fb26dc130db99cda4227257c10b9b8c38079b83f.tar.gz |
cperl-mode: Delete a misleading comment, add tests for verification
* lisp/progmodes/cperl-mode.el: Delete a comment which explains a
bug which has been fixed a long time ago (bug#44073).
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-mode-fontify-punct-vars): Add regression tests to verify
that fontification of punctuation variables doesn't start strings.
Diffstat (limited to 'test/lisp/progmodes/cperl-mode-tests.el')
-rw-r--r-- | test/lisp/progmodes/cperl-mode-tests.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index e2af2b5b8de..e67678cf6bb 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -196,4 +196,26 @@ Perl Best Practices sets some indentation values different from (should (equal got expected))))) (cperl-set-style "CPerl")))) +(ert-deftest cperl-mode-fontify-punct-vars () + "Test fontification of Perl's punctiation variables. +Perl has variable names containing unbalanced quotes for the list +separator $\" and pre- and postmatch $` and $'. A reference to +these variables, for example \\$\", should not cause the dollar +to be escaped, which would then start a string beginning with the +quote character. This used to be broken in cperl-mode at some +point in the distant past, and is still broken in perl-mode. " + (skip-unless (eq cperl-test-mode #'cperl-mode)) + (let ((file (ert-resource-file "fontify-punctuation-vars.pl"))) + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-min)) + (funcall cperl-test-mode) + (while (search-forward "##" nil t) + ;; The third element of syntax-ppss is true if in a string, + ;; which would indicate bad interpretation of the quote. The + ;; fourth element is true if in a comment, which should be the + ;; case. + (should (equal (nth 3 (syntax-ppss)) nil)) + (should (equal (nth 4 (syntax-ppss)) t)))))) + ;;; cperl-mode-tests.el ends here |