summaryrefslogtreecommitdiff
path: root/caddyconfig/caddyfile/formatter_test.go
diff options
context:
space:
mode:
authorVaibhav <vrongmeal@gmail.com>2020-03-17 21:25:36 +0530
committerGitHub <noreply@github.com>2020-03-17 09:55:36 -0600
commitf192ae5ea5c1e20e0c6aefc0772f0a92ee142f1e (patch)
treee10b529187e5135cef34c1ccb06fa18cc5ba9de5 /caddyconfig/caddyfile/formatter_test.go
parentb62f8e058270aff37621b69a9768235a01e8bd34 (diff)
cmd: fmt: Fix brace opening block indentation (#3153)
This fixes indentation for blocks starting with a brace as: ```Caddyfile { ... } ``` Fixes #3144 Signed-off-by: Vaibhav <vrongmeal@gmail.com>
Diffstat (limited to 'caddyconfig/caddyfile/formatter_test.go')
-rw-r--r--caddyconfig/caddyfile/formatter_test.go35
1 files changed, 34 insertions, 1 deletions
diff --git a/caddyconfig/caddyfile/formatter_test.go b/caddyconfig/caddyfile/formatter_test.go
index 76eca00..2aa6d27 100644
--- a/caddyconfig/caddyfile/formatter_test.go
+++ b/caddyconfig/caddyfile/formatter_test.go
@@ -45,6 +45,18 @@ m {
n { o
}
}
+
+{
+ p
+}
+
+ { q
+}
+
+ {
+{ r
+}
+}
`)
expected := []byte(`
a
@@ -75,6 +87,20 @@ m {
o
}
}
+
+{
+ p
+}
+
+{
+ q
+}
+
+{
+ {
+ r
+ }
+}
`)
testFormat(t, input, expected)
}
@@ -110,6 +136,9 @@ b {
d { {$E}
}
+
+{ {$F}
+}
`)
expected := []byte(`
{$A}
@@ -121,6 +150,10 @@ b {
d {
{$E}
}
+
+{
+ {$F}
+}
`)
testFormat(t, input, expected)
}
@@ -190,6 +223,6 @@ g {
func testFormat(t *testing.T, input, expected []byte) {
output := Format(input)
if string(output) != string(expected) {
- t.Errorf("Expected:\n%s\ngot:\n%s", string(output), string(expected))
+ t.Errorf("Expected:\n%s\ngot:\n%s", string(expected), string(output))
}
}