From 659acaa0b54830c2a71642f4d2cc2d5d48401b08 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 10 Nov 2023 21:02:43 +0100 Subject: [PATCH] Add CI test for escaping Test both escaping variables passed into debos and the new escaping template function Signed-off-by: Sjoerd Simons --- .github/workflows/ci.yaml | 1 + tests/escaping/test.yaml | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/escaping/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8ba7434..438641f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -125,6 +125,7 @@ jobs: - { name: "uml", backend: "--fakemachine-backend=uml" } test: - { name: "recipes", case: "recipes" } + - { name: "escaping", case: "escaping", variables: " -t escaped:\\$ba\\'d\\$gers\\ snakes" } - { name: "debian (amd64)", case: "debian", variables: "-t architecture:amd64" } - { name: "debian (arm64)", case: "debian", variables: "-t architecture:arm64" } - { name: "debian (armhf)", case: "debian", variables: "-t architecture:armhf" } diff --git a/tests/escaping/test.yaml b/tests/escaping/test.yaml new file mode 100644 index 0000000..b24fd8c --- /dev/null +++ b/tests/escaping/test.yaml @@ -0,0 +1,20 @@ +# expected to be run with -t escaled:\$bad\'ge\$rs or similar to verify passing +# variables onwards +{{ $escaped := or .escaped "$mu'room$" }} +architecture: amd64 + +actions: + - action: run + description: test escaping + chroot: false + command: echo {{ escape $escaped }} > test.a + - action: run + description: test escaping + chroot: false + command: |- + cat << 'EOF' > test.b + {{ $escaped }} + EOF + - action: run + chroot: false + command: diff -u test.a test.b