diff options
author | Harald Jörg <haj@posteo.de> | 2021-03-24 17:06:21 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-03-24 17:06:21 +0100 |
commit | 1ac8cd3ef673054720d88dbc5019677d70d3c26c (patch) | |
tree | 2be848e7e59190aed81ef203f2e243c4908d304f /test/lisp | |
parent | 39f16a7d396a9e8299b0447cdf87a07a4fbf4d53 (diff) | |
download | emacs-1ac8cd3ef673054720d88dbc5019677d70d3c26c.tar.gz emacs-1ac8cd3ef673054720d88dbc5019677d70d3c26c.tar.bz2 emacs-1ac8cd3ef673054720d88dbc5019677d70d3c26c.zip |
perl-mode: Fix regexps for fontification
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-declarations): New test to ensure consistency
between perl-mode.el and cperl-mode.el (bug#47345).
* lisp/progmodes/perl-mode.el (perl-font-lock-keywords-1): pick
correct capture groups for "use Pack::Age;"
Fontify all components of "Pack::Age", not just "Pack"
(perl-font-lock-keywords-2): Use keyword-face for declarators
Diffstat (limited to 'test/lisp')
-rw-r--r-- | test/lisp/progmodes/cperl-mode-tests.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 8078e9c9fa9..14bc48b92fd 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -135,6 +135,25 @@ point in the distant past, and is still broken in perl-mode. " (should (equal (nth 3 (syntax-ppss)) nil)) (should (equal (nth 4 (syntax-ppss)) t)))))) +(ert-deftest cperl-test-fontify-declarations () + "Test that declarations and package usage use consistent fontification." + (with-temp-buffer + (funcall cperl-test-mode) + (insert "package Foo::Bar;\n") + (insert "use Fee::Fie::Foe::Foo\n;") + (insert "my $xyzzy = 'PLUGH';\n") + (goto-char (point-min)) + (font-lock-ensure) + (search-forward "Bar") + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-function-name-face)) + (search-forward "use") ; This was buggy in perl-mode + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-keyword-face)) + (search-forward "my") + (should (equal (get-text-property (match-beginning 0) 'face) + 'font-lock-keyword-face)))) + (defvar perl-continued-statement-offset) (defvar perl-indent-level) |