diff options
author | Francis Lavoie <[email protected]> | 2024-10-10 16:26:59 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-10 20:26:59 +0000 |
commit | ef4e0224a8495fc29847d865087febdee8736e3b (patch) | |
tree | 9898cd3e23d0de6429a8a4b67d94e8fcf39d29a8 /caddyconfig/caddyfile/parse_test.go | |
parent | c8a76d003f700b448291845b7879f27c2f19d1dc (diff) | |
download | caddy-ef4e0224a8495fc29847d865087febdee8736e3b.tar.gz caddy-ef4e0224a8495fc29847d865087febdee8736e3b.zip |
caddyfile: Fix comma edgecase in address parsing (#6616)
Diffstat (limited to 'caddyconfig/caddyfile/parse_test.go')
-rw-r--r-- | 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 7157b2b5f..d3fada4e0 100644 --- a/caddyconfig/caddyfile/parse_test.go +++ b/caddyconfig/caddyfile/parse_test.go @@ -555,6 +555,10 @@ func TestParseAll(t *testing.T) { {"localhost:1234", "http://host2"}, }}, + {`foo.example.com , example.com`, false, [][]string{ + {"foo.example.com", "example.com"}, + }}, + {`localhost:1234, http://host2,`, true, [][]string{}}, {`http://host1.com, http://host2.com { @@ -614,8 +618,8 @@ func TestParseAll(t *testing.T) { } for j, block := range blocks { if len(block.Keys) != len(test.keys[j]) { - t.Errorf("Test %d: Expected %d keys in block %d, got %d", - i, len(test.keys[j]), j, len(block.Keys)) + t.Errorf("Test %d: Expected %d keys in block %d, got %d: %v", + i, len(test.keys[j]), j, len(block.Keys), block.Keys) continue } for k, addr := range block.GetKeysText() { |