@@ -322,15 +322,59 @@ EOF same-line-arg
322
322
},
323
323
},
324
324
{
325
- input : []byte (`heredoc <EOF
325
+ input : []byte (`escaped-heredoc \<< >>` ),
326
+ expected : []Token {
327
+ {Line : 1 , Text : `escaped-heredoc` },
328
+ {Line : 1 , Text : `<<` },
329
+ {Line : 1 , Text : `>>` },
330
+ },
331
+ },
332
+ {
333
+ input : []byte (`not-a-heredoc <EOF
326
334
content
327
- EOF same-line-arg
328
335
` ),
329
336
expected : []Token {
330
- {Line : 1 , Text : `heredoc` },
337
+ {Line : 1 , Text : `not-a- heredoc` },
331
338
{Line : 1 , Text : `<EOF` },
332
339
{Line : 2 , Text : `content` },
333
- {Line : 3 , Text : `EOF` },
340
+ },
341
+ },
342
+ {
343
+ input : []byte (`not-a-heredoc <<<EOF content` ),
344
+ expected : []Token {
345
+ {Line : 1 , Text : `not-a-heredoc` },
346
+ {Line : 1 , Text : `<<<EOF` },
347
+ {Line : 1 , Text : `content` },
348
+ },
349
+ },
350
+ {
351
+ input : []byte (`not-a-heredoc "<<" ">>"` ),
352
+ expected : []Token {
353
+ {Line : 1 , Text : `not-a-heredoc` },
354
+ {Line : 1 , Text : `<<` },
355
+ {Line : 1 , Text : `>>` },
356
+ },
357
+ },
358
+ {
359
+ input : []byte (`not-a-heredoc << >>` ),
360
+ expected : []Token {
361
+ {Line : 1 , Text : `not-a-heredoc` },
362
+ {Line : 1 , Text : `<<` },
363
+ {Line : 1 , Text : `>>` },
364
+ },
365
+ },
366
+ {
367
+ input : []byte (`not-a-heredoc <<HERE SAME LINE
368
+ content
369
+ HERE same-line-arg
370
+ ` ),
371
+ expected : []Token {
372
+ {Line : 1 , Text : `not-a-heredoc` },
373
+ {Line : 1 , Text : `<<HERE` },
374
+ {Line : 1 , Text : `SAME` },
375
+ {Line : 1 , Text : `LINE` },
376
+ {Line : 2 , Text : `content` },
377
+ {Line : 3 , Text : `HERE` },
334
378
{Line : 3 , Text : `same-line-arg` },
335
379
},
336
380
},
@@ -365,14 +409,6 @@ EOF same-line-arg
365
409
},
366
410
},
367
411
},
368
- {
369
- input : []byte (`heredoc <<HERE SAME LINE
370
- content
371
- HERE same-line-arg
372
- ` ),
373
- expectErr : true ,
374
- errorMessage : "heredoc marker on line #1 must contain only alpha-numeric characters, dashes and underscores; got 'HERE SAME LINE'" ,
375
- },
376
412
{
377
413
input : []byte (`heredoc <<<EOF
378
414
content
0 commit comments