mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-06 17:40:58 +00:00
Fix format function {{, }} are escapes (#752)
* Fix format function {{, }} are escapes Added some tests for some corner cases * Update format function added 2 error checks
This commit is contained in:
parent
faaee889d5
commit
65f74c5c50
2 changed files with 38 additions and 6 deletions
|
@ -110,6 +110,14 @@ func TestEvaluate(t *testing.T) {
|
|||
{"env.key", "value", ""},
|
||||
{"secrets.CASE_INSENSITIVE_SECRET", "value", ""},
|
||||
{"secrets.case_insensitive_secret", "value", ""},
|
||||
{"format('{{0}}', 'test')", "{0}", ""},
|
||||
{"format('{{{0}}}', 'test')", "{test}", ""},
|
||||
{"format('}}')", "}", ""},
|
||||
{"format('echo Hello {0} ${{Test}}', 'World')", "echo Hello World ${Test}", ""},
|
||||
{"format('echo Hello {0} ${{Test}}', github.undefined_property)", "echo Hello ${Test}", ""},
|
||||
{"format('echo Hello {0}{1} ${{Te{0}st}}', github.undefined_property, 'World')", "echo Hello World ${Test}", ""},
|
||||
{"format('{0}', '{1}', 'World')", "{1}", ""},
|
||||
{"format('{{{0}', '{1}', 'World')", "{{1}", ""},
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue