From 0f155d00e9ec9a629566b05ae5b713dbccb1b8a6 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Sat, 28 Oct 2023 11:08:57 +0900 Subject: [PATCH] Listing variable expansion patterns in the Include runner. --- operator_test.go | 2 +- testdata/book/include_loop.yml | 14 -------------- testdata/book/include_str_int.yml | 9 --------- testdata/book/include_vars_included.yml | 17 +++++++++++++++++ testdata/book/include_vars_main.yml | 21 +++++++++++++++++++++ 5 files changed, 39 insertions(+), 24 deletions(-) delete mode 100644 testdata/book/include_loop.yml delete mode 100644 testdata/book/include_str_int.yml create mode 100644 testdata/book/include_vars_included.yml create mode 100644 testdata/book/include_vars_main.yml diff --git a/operator_test.go b/operator_test.go index 3c57db02..de9be2a1 100644 --- a/operator_test.go +++ b/operator_test.go @@ -259,7 +259,6 @@ func TestRunUsingLoop(t *testing.T) { book string }{ {"testdata/book/loop.yml"}, - {"testdata/book/include_loop.yml"}, } ctx := context.Background() for _, tt := range tests { @@ -502,6 +501,7 @@ func TestInclude(t *testing.T) { book string }{ {"testdata/book/include_main.yml"}, + {"testdata/book/include_vars.yml"}, } ctx := context.Background() for _, tt := range tests { diff --git a/testdata/book/include_loop.yml b/testdata/book/include_loop.yml deleted file mode 100644 index 3453325c..00000000 --- a/testdata/book/include_loop.yml +++ /dev/null @@ -1,14 +0,0 @@ -desc: Test include loop(include was not involved.) -vars: - lists: - - 1 - - 2 - - 3 - int: 1 -steps: - include_not_loop: - include: - path: include_str_int.yml - vars: - a: '010000000{{ vars.int }}' - b: '1601{{ vars.int }}' diff --git a/testdata/book/include_str_int.yml b/testdata/book/include_str_int.yml deleted file mode 100644 index 054b38e6..00000000 --- a/testdata/book/include_str_int.yml +++ /dev/null @@ -1,9 +0,0 @@ -desc: For include loop test -vars: - a: null - b: null -steps: - t_main: - test: | - vars.a == "0100000001" - && vars.b == "16011" diff --git a/testdata/book/include_vars_included.yml b/testdata/book/include_vars_included.yml new file mode 100644 index 00000000..ea60a2af --- /dev/null +++ b/testdata/book/include_vars_included.yml @@ -0,0 +1,17 @@ +desc: Include vars (included) +if: included +steps: + - + test: | + vars.a == 12345 + && vars.b == "54321" + && vars.c == 12345 + && vars.d == 54321 + && vars.e == 123459 + && vars.f == 543219 + && vars.g == 912345 + && vars.h == 954321 + && vars.i == "12345" + && vars.j == "54321" + && vars.k == "123459" + && vars.l == "543219" diff --git a/testdata/book/include_vars_main.yml b/testdata/book/include_vars_main.yml new file mode 100644 index 00000000..f47c0037 --- /dev/null +++ b/testdata/book/include_vars_main.yml @@ -0,0 +1,21 @@ +desc: Include vars +vars: + intNumber: 12345 + strNumber: "54321" +steps: + - + include: + path: include_vars_included.yml + vars: + a: 12345 + b: "54321" + c: '{{ vars.intNumber }}' + d: '{{ vars.strNumber }}' + e: '{{ vars.intNumber }}9' + f: '{{ vars.strNumber }}9' + g: '9{{ vars.intNumber }}' + h: '9{{ vars.strNumber }}' + i: '{{ string(vars.intNumber) }}' + j: '{{ string(vars.strNumber) }}' + k: '"{{ vars.intNumber }}9"' + l: '"{{ vars.strNumber }}9"'