Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Could be hardened further...
- Loading branch information
Polgár Márton
committed
Mar 20, 2023
1 parent
cbb6a62
commit 1d0c3b0
Showing
1 changed file
with
39 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,39 @@ | ||
use Test; | ||
use Template6; | ||
|
||
my Template6 $t .= new(); | ||
|
||
plan 5; | ||
|
||
$t.add-template('brackets_after_space_hardcoded',q:to<END>); | ||
{{ foo }} | ||
END | ||
|
||
is $t.process('brackets_after_space_hardcoded').chomp, ' {{ foo }}', 'Brackets after a space, hardcoded.'; | ||
|
||
$t.add-template('brackets_beginning_hardcoded',q:to<END>); | ||
{{ foo }} | ||
END | ||
|
||
is $t.process('brackets_beginning_hardcoded').chomp, '{{ foo }}', 'Brackets at the very beginning, hardcoded.'; | ||
|
||
$t.add-template('unescape_attempt',Q:to<END>); | ||
\qq{{ foo }} | ||
END | ||
|
||
is $t.process('unescape_attempt').chomp, '\\qq{{ foo }}', 'Attempting to break out of literal quoting.'; | ||
|
||
my $template-content = Q:to<END>; | ||
END1END2END3 | ||
END1 | ||
END2 | ||
END4 | ||
END | ||
$t.add-template('heredoc_terminal_attempt',$template-content); | ||
my $used-delimiter = $t.service.context.parser.get-safe-delimiter($template-content); | ||
|
||
|
||
is $t.process('heredoc_terminal_attempt').chomp, "END1END2END3\nEND1\nEND2\nEND4", 'Attempting to break out of heredoc.'; | ||
is $used-delimiter, 'END3', 'The right delimiter was used in the internal form.'; | ||
|
||
# vim: expandtab shiftwidth=4 |