aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddyconfig/httpcaddyfile/builtins_test.go
diff options
context:
space:
mode:
authorWeidiDeng <[email protected]>2023-05-23 05:36:55 +0800
committerGitHub <[email protected]>2023-05-22 15:36:55 -0600
commitcee4441cb1d485b38d728168a315cda5641d84fb (patch)
treeb024ba176895a72d31993e8c069626adfe46fac9 /caddyconfig/httpcaddyfile/builtins_test.go
parent5bd9c49042112183f0902a7ce6252aebf58e1ac9 (diff)
downloadcaddy-cee4441cb1d485b38d728168a315cda5641d84fb.tar.gz
caddy-cee4441cb1d485b38d728168a315cda5641d84fb.zip
caddyfile: Do not replace import tokens if they are part of a snippet (#5539)
* fix variadic placeholder in imported file which also imports * fix tests. * skip replacing args when imported token may be part of a snippet
Diffstat (limited to 'caddyconfig/httpcaddyfile/builtins_test.go')
-rw-r--r--caddyconfig/httpcaddyfile/builtins_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/builtins_test.go b/caddyconfig/httpcaddyfile/builtins_test.go
index 6ae4b3114..34b41247f 100644
--- a/caddyconfig/httpcaddyfile/builtins_test.go
+++ b/caddyconfig/httpcaddyfile/builtins_test.go
@@ -243,6 +243,27 @@ func TestImportErrorLine(t *testing.T) {
return err != nil && strings.Contains(err.Error(), "Caddyfile:5 (import t1):2")
},
},
+ {
+ input: `
+ import testdata/import_variadic_snippet.txt
+ :8080 {
+ import t1 true
+ }`,
+ errorFunc: func(err error) bool {
+ return err == nil
+ },
+ },
+ {
+ input: `
+ import testdata/import_variadic_with_import.txt
+ :8080 {
+ import t1 true
+ import t2 true
+ }`,
+ errorFunc: func(err error) bool {
+ return err == nil
+ },
+ },
} {
adapter := caddyfile.Adapter{
ServerType: ServerType{},