Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String containing vars number expanded by include is interpreted as a numerical value #660

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ func TestIncludeRunnerRun(t *testing.T) {
{"testdata/book/db.yml", map[string]any{}, 8},
{"testdata/book/db.yml", map[string]any{"foo": "bar"}, 8},
{"testdata/book/db.yml", map[string]any{"json": "json://../vars.json"}, 8},
{
"testdata/book/include_str_int.yml",
map[string]any{
"a": "010000000{{ vars.int }}",
"b": "1601{{ vars.int }}",
"int": 1,
},
1,
},
}
ctx := context.Background()
for _, tt := range tests {
Expand Down
1 change: 1 addition & 0 deletions operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func TestRunUsingLoop(t *testing.T) {
book string
}{
{"testdata/book/loop.yml"},
{"testdata/book/include_loop.yml"},
}
ctx := context.Background()
for _, tt := range tests {
Expand Down
14 changes: 14 additions & 0 deletions testdata/book/include_loop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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 }}'
Comment on lines +13 to +14
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following will be correctly recognized as characters

Suggested change
a: '010000000{{ vars.int }}'
b: '1601{{ vars.int }}'
a: '"010000000{{ vars.int }}"'
b: '"1601{{ vars.int }}"'

9 changes: 9 additions & 0 deletions testdata/book/include_str_int.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
desc: For include loop test
vars:
a: null
b: null
steps:
t_main:
test: |
vars.a == "0100000001"
&& vars.b == "16011"
Loading