summaryrefslogtreecommitdiff
path: root/caddyconfig/caddyfile/formatter_test.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2020-05-05 14:32:12 -0400
committerGitHub <noreply@github.com>2020-05-05 12:32:12 -0600
commit96d6d277a453a602b9ec49131d8e332ce7aefcad (patch)
tree6e34311edcc3c82b7c9436d145a122fba7b65258 /caddyconfig/caddyfile/formatter_test.go
parent26e559662d677062874afed9775f660f1f5f9c1e (diff)
caddyconfig: Don't start comments in middle of tokens (#3267)
* caddyconfig: Only parse # as start of comment if preceded by space * caddyconfig: Simplify # logic using len(val), add a test
Diffstat (limited to 'caddyconfig/caddyfile/formatter_test.go')
-rw-r--r--caddyconfig/caddyfile/formatter_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/caddyconfig/caddyfile/formatter_test.go b/caddyconfig/caddyfile/formatter_test.go
index 25bd7fa..6751eca 100644
--- a/caddyconfig/caddyfile/formatter_test.go
+++ b/caddyconfig/caddyfile/formatter_test.go
@@ -201,7 +201,7 @@ c
}
d {
- e #f
+ e#f
# g
}
@@ -229,7 +229,7 @@ bar"
j {
"\"k\" l m"
}`,
- expect: `"a \"b\" " #c
+ expect: `"a \"b\" "#c
d
e {
@@ -305,6 +305,11 @@ bar "{\"key\":34}"`,
baz`,
},
+ {
+ description: "hash within string is not a comment",
+ input: `redir / /some/#/path`,
+ expect: `redir / /some/#/path`,
+ },
} {
// the formatter should output a trailing newline,
// even if the tests aren't written to expect that