-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for more templating functions
Renaming the escaping test to a general templating test and add tests for a selection of functions from sprig-slim as well as the builtin sector function Signed-off-by: Sjoerd Simons <[email protected]>
- Loading branch information
1 parent
7297885
commit 94d0610
Showing
3 changed files
with
38 additions
and
21 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
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
# expected to be run with -t escaped:\$bad\'ge\$rs or similar to verify passing | ||
# variables onwards | ||
{{ $escaped := or .escaped "$mu'room$" }} | ||
architecture: amd64 | ||
|
||
actions: | ||
- action: run | ||
description: test escaping in command | ||
chroot: false | ||
command: echo {{ escape $escaped }} > test.a | ||
- action: run | ||
description: escaping via heredoc | ||
chroot: false | ||
command: |- | ||
cat << 'EOF' > test.b | ||
{{ $escaped }} | ||
EOF | ||
- action: run | ||
description: validate escaping | ||
chroot: false | ||
command: diff -u test.a test.b | ||
- action: run | ||
description: sector custom function | ||
chroot: false | ||
command: test 4096 -eq {{ sector 8 }} | ||
- action: run | ||
description: sprig string functions | ||
chroot: false | ||
command: test "HELLOHELLO" = {{ "hello" | upper | repeat 2 }} | ||
- action: run | ||
description: sprig integer math functions | ||
chroot: false | ||
command: test 42 -eq {{ mul 4 10 | add 2 }} | ||
- action: run | ||
description: sprig conversion function | ||
chroot: false | ||
command: test 42 -eq {{ 0x2a | int }} |