all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 13d879bf762d3136b3a8a73372afd099640b3a71 3296 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
 
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 correctly.
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

=head2 Test case 7

An indented HERE document using a bare identifier.

=cut

## test case

$text = <<~HERE;
look-here
HERE

$noindent = "New statement in this line";

=head2 Test case 8

A HERE document as an argument to print when printing to a filehandle.

=cut

## test case

print $fh <<~HERE;
look-here
HERE

$noindent = "New statement in this line";

=head2 Test case 9

A HERE document as a hash value.

=cut

my %foo = (
    text => <<~HERE
look-here
HERE
    );

$noindent = "New statement in this line";

=head2 Test case 10

A HERE document as an argument to die.

=cut

1 or die <<HERE;
look-here
HERE

$noindent = "New statement in this line";

=head2 Test case 11

A HERE document as an argument to warn.

=cut

1 or warn <<HERE;
look-here
HERE

$noindent = "New statement in this line";

__END__

debug log:

solving 13d879bf76 ...
found 13d879bf76 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.