mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-24 16:59:00 +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 comment {
|
||||||
if ch == '\n' {
|
if ch == '\n' {
|
||||||
comment = false
|
comment = false
|
||||||
|
nextLine()
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
write(ch)
|
write(ch)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -310,6 +310,17 @@ baz`,
|
||||||
input: `redir / /some/#/path`,
|
input: `redir / /some/#/path`,
|
||||||
expect: `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,
|
// the formatter should output a trailing newline,
|
||||||
// even if the tests aren't written to expect that
|
// even if the tests aren't written to expect that
|
||||||
|
|
Loading…
Reference in a new issue