mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
; cperl-mode.el: Fix fontification of flip-flop (Bug#72296)
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Prevent a movement of point from bleeding into a following clause. * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-72296): Add a test for the flip-flop operator with code from the report.
This commit is contained in:
parent
fcd4e4c895
commit
c27055a938
2 changed files with 18 additions and 1 deletions
|
|
@ -1573,6 +1573,23 @@ not appropriate."
|
|||
(should (equal (get-text-property (point) 'face)
|
||||
font-lock-string-face))))))
|
||||
|
||||
(ert-deftest cperl-test-bug-72296 ()
|
||||
"Verify that the perl modes correctly handle the flip-flop operator.
|
||||
Two successive dots are an operator. A slash immediately following them
|
||||
starts a regular expression, if there's another term between the dots
|
||||
and the slash, then we have a division."
|
||||
:tags '(:fontification)
|
||||
;; Code from the bug report. The slash is a division. The following
|
||||
;; number is not a string.
|
||||
(let ((code "for (2..$n/2) { ...; }"))
|
||||
(should (equal (nth 8 (cperl-test-ppss code "/")) nil)))
|
||||
;; This is what the test for two successive dots wants to catch: The
|
||||
;; flip-flop operator. Here, the number is part of a regexp, seen as
|
||||
;; a string.
|
||||
(let ((code "for (2../2/) { ...; }"))
|
||||
(should (equal (nth 8 (cperl-test-ppss code "/")) 9)))
|
||||
)
|
||||
|
||||
(ert-deftest test-indentation ()
|
||||
(ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue