diff options
author | Francis Lavoie <lavofr@gmail.com> | 2020-06-01 12:43:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 10:43:06 -0600 |
commit | fdf2a77feb53cb9dd6de772f811e96a5f6b2d2c4 (patch) | |
tree | 9dc596a40de9c076519eed900c1791aabe65f52b /caddyconfig/caddyfile/parse_test.go | |
parent | a496308f6eb57f8dd2e1598bfb624a3e567aa4e1 (diff) |
caddyfile: Add args on imports (#3423)
* caddyfile: Add support for args on imports
* caddyfile: Add more import args tests
Diffstat (limited to 'caddyconfig/caddyfile/parse_test.go')
-rwxr-xr-x | caddyconfig/caddyfile/parse_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/caddyconfig/caddyfile/parse_test.go b/caddyconfig/caddyfile/parse_test.go index ed15367..12c30c8 100755 --- a/caddyconfig/caddyfile/parse_test.go +++ b/caddyconfig/caddyfile/parse_test.go @@ -182,14 +182,17 @@ func TestParseOneAndImport(t *testing.T) { "host1", }, []int{1, 2}}, - {`import testdata/import_test1.txt testdata/import_test2.txt`, true, []string{}, []int{}}, - {`import testdata/not_found.txt`, true, []string{}, []int{}}, {`""`, false, []string{}, []int{}}, {``, false, []string{}, []int{}}, + // 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{}}, + {`import testdata/import_args*.txt a b`, false, []string{"a"}, []int{2}}, + // test cases found by fuzzing! {`import }{$"`, true, []string{}, []int{}}, {`import /*/*.txt`, true, []string{}, []int{}}, @@ -210,6 +213,7 @@ func TestParseOneAndImport(t *testing.T) { t.Errorf("Test %d: Expected no error, but got: %v", i, err) } + // t.Logf("%+v\n", result) if len(result.Keys) != len(test.keys) { t.Errorf("Test %d: Expected %d keys, got %d", i, len(test.keys), len(result.Keys)) |