unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 8af4625fff3684f36dcd7bed43e176020b649b98 2491 bytes (raw)
name: test/lisp/progmodes/cperl-mode-resources/here-docs.pl 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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__

debug log:

solving 8af4625fff ...
found 8af4625fff in https://git.savannah.gnu.org/cgit/emacs.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).