Matthew Holt
4 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
2 changed files with
13 additions and
0 deletions
-
caddyconfig/caddyfile/formatter.go
-
caddyconfig/caddyfile/formatter_test.go
|
@ -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
|
|
|