mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-24 08:49:01 +01:00
caddyfile: Fix minor bug in formatter
This commit is contained in:
parent
e384f07a3c
commit
635f075f18
2 changed files with 13 additions and 0 deletions
|
@ -78,6 +78,8 @@ func Format(input []byte) []byte {
|
|||
if comment {
|
||||
if ch == '\n' {
|
||||
comment = false
|
||||
nextLine()
|
||||
continue
|
||||
} else {
|
||||
write(ch)
|
||||
continue
|
||||
|
|
|
@ -310,6 +310,17 @@ baz`,
|
|||
input: `redir / /some/#/path`,
|
||||
expect: `redir / /some/#/path`,
|
||||
},
|
||||
{
|
||||
description: "brace does not fold into comment above",
|
||||
input: `# comment
|
||||
{
|
||||
foo
|
||||
}`,
|
||||
expect: `# comment
|
||||
{
|
||||
foo
|
||||
}`,
|
||||
},
|
||||
} {
|
||||
// the formatter should output a trailing newline,
|
||||
// even if the tests aren't written to expect that
|
||||
|
|
Loading…
Reference in a new issue