Files
Philip Conrad 63e1877c48 linters+testdata: Reformat all yaml testcases for linting. (#6511)
This commit adds a config for yamllint, mass-reformats all of
the existing Yaml testcases to pass linting, and adds a Yaml
linting job to the pull-request Github Actions workflow. A few 
careful exceptions and ignores were added to the linter's
config to allow keeping our existing Yaml files with minimal
reformatting.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
2024-01-10 13:16:01 -05:00

50 lines
1.3 KiB
YAML

---
cases:
- note: rendertemplate/simple
query: data.test.p = x
modules:
- |
package test
template_string = `{{.test}}`
template_vars = {`test`: `hello world`}
p = strings.render_template(template_string, template_vars)
want_result:
- x: "hello world"
- note: rendertemplate/simpleint
query: data.test.p = x
modules:
- |
package test
template_string = `{{.test}}`
template_vars = {`test`: 2023}
p = strings.render_template(template_string, template_vars)
want_result:
- x: "2023"
- note: rendertemplate/complex
query: data.test.p = x
modules:
- |
package test
template_string = `{{range $i, $name := .hellonames}}{{if $i}},{{end}}hello {{$name}}{{end}}`
template_vars = {`hellonames`: [`rohan`, `john doe`]}
p = strings.render_template(template_string, template_vars)
want_result:
- x: "hello rohan,hello john doe"
- note: rendertemplate/missingkey
query: data.test.p = x
modules:
- |
package test
template_string = `{{.testvarnotprovided}}`
template_vars = {`test`: `hello world`}
p = strings.render_template(template_string, template_vars)
want_error_code: eval_builtin_error
strict_error: true