diff options
author | Harald Jörg <haj@posteo.de> | 2021-01-05 10:15:04 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-01-05 10:15:04 +0100 |
commit | 06810abc591fb40450bcf448d584316d26e8e98b (patch) | |
tree | 39e84f75380143ed023c43339eba017dce90b445 /test/lisp/progmodes/cperl-mode-resources/here-docs.pl | |
parent | 8ef4314c44a046e92bcd7dddde26203a9d641f09 (diff) | |
download | emacs-06810abc591fb40450bcf448d584316d26e8e98b.tar.gz emacs-06810abc591fb40450bcf448d584316d26e8e98b.tar.bz2 emacs-06810abc591fb40450bcf448d584316d26e8e98b.zip |
perl-mode: Display here-docs as strings instead of comments
* lisp/progmodes/perl-mode.el
(perl-syntax-propertize-function): Handle HERE doc starter
lines ending in a comment.
(perl-heredoc): New face for HERE docs, inheriting from
font-lock-string-face.
(perl-font-lock-syntactic-face-function): Apply the new face
to HERE docs (Bug#23461).
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test--run-bug-10483): Skip for Perl mode. The test
explicitly calls a function of CPerl mode.
Diffstat (limited to 'test/lisp/progmodes/cperl-mode-resources/here-docs.pl')
-rw-r--r-- | test/lisp/progmodes/cperl-mode-resources/here-docs.pl | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/test/lisp/progmodes/cperl-mode-resources/here-docs.pl b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl new file mode 100644 index 00000000000..8af4625fff3 --- /dev/null +++ b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl @@ -0,0 +1,143 @@ +use 5.020; + +=head1 NAME + +here-docs.pl - resource file for cperl-test-here-docs + +=head1 DESCRIPTION + +This file holds a couple of HERE documents, with a variety of normal +and edge cases. For a formatted view of this description, run: + + (cperl-perldoc "here-docs.pl") + +For each of the HERE documents, the following checks will done: + +=over 4 + +=item * + +All occurrences of the string "look-here" are fontified correcty. +Note that we deliberately test the face, not the syntax property: +Users won't care for the syntax property, but they see the face. +Different implementations with different syntax properties have been +seen in the past. + +=item * + +Indentation of the line(s) containing "look-here" is 0, i.e. there are no +leading spaces. + +=item * + +Indentation of the following perl statement containing "indent" should +be 0 if the statement contains "noindent", and according to the mode's +continued-statement-offset otherwise. + +=back + +=cut + +# Prologue to make the test file valid without warnings + +my $text; +my $any; +my $indentation; +my $anywhere = 'back again'; +my $noindent; + +=head1 The Tests + +=head2 Test Case 1 + +We have two HERE documents in one line with different quoting styles. + +=cut + +## test case + +$text = <<"HERE" . <<'THERE' . $any; +#look-here and +HERE +$tlook-here and +THERE + +$noindent = "This should be left-justified"; + +=head2 Test case 2 + +A HERE document followed by a continuation line + +=cut + +## test case + +$text = <<HERE +look-here +HERE + +. 'indent-level'; # Continuation, should be indented + +=head2 Test case 3 + +A here document with a line-end comment in the starter line, +after a complete statement + +=cut + +## test case + +$text = <<HERE; # start here +look-here +HERE + +$noindent = "New statement in this line"; + +=head2 Test case 4 + +A HERE document with a to-be-continued statement and a comment in the +starter line. + +=cut + +## test case + +$text = <<HERE # start here +look-here +HERE + +. 'indent-level'; # Continuation, should be indented + +=head2 Test case 5 + +A HERE document with a comment sign, but no comment to follow. + + +=cut + +## test case + +$text = <<HERE; # +look-here +HERE + +$noindent = "New statement in this line"; + +=head2 Test case 6 + +A HERE document with a comment sign, but no comment to follow, with a +statement to be continued. Also, the character before the comment +sign has a relevant syntax property (end of string in our case) which +must be preserved. + +=cut + +## test case + +$text = <<"HERE"# +look-here +HERE + +. 'indent-level'; # Continuation, should be indented + +__END__ |