diff options
author | Francis Lavoie <lavofr@gmail.com> | 2022-03-23 14:34:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 12:34:13 -0600 |
commit | 134b8056444d8f417c0eb4163809f9659ffc3317 (patch) | |
tree | 62bc3fc0af4af24926730f63af56740943e3f36f /caddyconfig/caddyfile/parse_test.go | |
parent | c9b5e7f77b8aac7334d81c552c583af81ba1c400 (diff) |
caddyfile: Prevent bad block opening tokens (#4655)
* caddyfile: Prevent bad block opening tokens
* Clarifying comments
Diffstat (limited to 'caddyconfig/caddyfile/parse_test.go')
-rwxr-xr-x | caddyconfig/caddyfile/parse_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/caddyconfig/caddyfile/parse_test.go b/caddyconfig/caddyfile/parse_test.go index 8d43e1a..c3f6fa6 100755 --- a/caddyconfig/caddyfile/parse_test.go +++ b/caddyconfig/caddyfile/parse_test.go @@ -191,6 +191,20 @@ func TestParseOneAndImport(t *testing.T) { {``, false, []string{}, []int{}}, + // Unexpected next token after '{' on same line + {`localhost + dir1 { a b }`, true, []string{"localhost"}, []int{}}, + // Workaround with quotes + {`localhost + dir1 "{" a b "}"`, false, []string{"localhost"}, []int{5}}, + + // Unexpected '{}' at end of line + {`localhost + dir1 {}`, true, []string{"localhost"}, []int{}}, + // Workaround with quotes + {`localhost + dir1 "{}"`, false, []string{"localhost"}, []int{2}}, + // import with args {`import testdata/import_args0.txt a`, false, []string{"a"}, []int{}}, {`import testdata/import_args1.txt a b`, false, []string{"a", "b"}, []int{}}, |