Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add tests for advent 2013 day 04 (incomplete)
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| use v6; | ||
| use Test; | ||
|
|
||
| plan 7; | ||
|
|
||
| is q:to"FIN", "Hello again.\n", 'basic heredoc with :to'; | ||
| Hello again. | ||
| FIN | ||
|
|
||
| my $str = q[q:to"noend"; | ||
| HELLO WORLD noend | ||
| ]; | ||
|
|
||
| eval_dies_ok $str, 'Runaway multiline is an error'; | ||
|
|
||
| is q:to[finished], " Hello there\n everybody\n", "indention of heredocs | ||
| (1)"; | ||
| Hello there | ||
| everybody | ||
| finished | ||
| my $first = q:to/END/; | ||
| HELLO | ||
| WORLD | ||
| END | ||
|
|
||
| my $second = q:to/END/; | ||
| HELLO | ||
| WORLD | ||
| END | ||
|
|
||
| is $first, $second, "Indention stripped to end delimiter indention"; | ||
|
|
||
| my $dlrs = 21; | ||
| my $cnts = 18; | ||
|
|
||
| is q:to/EOF/.chop, '$dlrs dollars and {$cnts} cents.', 'no interpolation by | ||
| default'; | ||
| $dlrs dollars and {$cnts} cents. | ||
| EOF | ||
|
|
||
| #?rakudo todo ':c in heredocs' | ||
| is q:to:c/EOF/.chop, '$dlrs dollars and 18 cents.', ':c enables closure compilation'; | ||
| $dlrs dollars and {$cnts} cents. | ||
| EOF | ||
|
|
||
| is qq:to/EOF/.chop, '21 dollars and 18 cents.', 'heredocs with qq interpolate'; | ||
| $dlrs dollars and {$cnts} cents. | ||
| EOF |