--- /dev/null
+gofumpt -w foo.go
+cmp foo.go foo.go.golden
+
+gofumpt -d foo.go.golden
+! stdout .
+
+-- foo.go --
+package p
+
+func f(r rune) {
+ switch r {
+ case 'a',
+ 'b',
+ 'c':
+
+ case 'd', 'e', 'f':
+
+ case 'a', 'b',
+ 'c':
+
+ case 'v', 'e', 'r', 'y', 'l', 'o', 'n', 'g',
+ 'l', 'i', 's', 't', '.', '.', '.':
+
+ // before
+ case 'a',
+ 'b': // inline
+ // after
+
+ case 'a', // middle
+ 'b':
+
+ case 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g': // very very long inline comment at the end
+
+ case 'a', 'b', 'c',
+ 'd': // short comment
+ }
+ {
+ {
+ {
+ {
+ {
+ switch r {
+ case 'i', 'n', 'd', 'e',
+ 'n', 't', 'e', 'd':
+ }
+ }
+ }
+ }
+ }
+ }
+}
+-- foo.go.golden --
+package p
+
+func f(r rune) {
+ switch r {
+ case 'a', 'b', 'c':
+
+ case 'd', 'e', 'f':
+
+ case 'a', 'b', 'c':
+
+ case 'v', 'e', 'r', 'y', 'l', 'o', 'n', 'g',
+ 'l', 'i', 's', 't', '.', '.', '.':
+
+ // before
+ case 'a', 'b': // inline
+ // after
+
+ case 'a', // middle
+ 'b':
+
+ case 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g': // very very long inline comment at the end
+
+ case 'a', 'b', 'c', 'd': // short comment
+ }
+ {
+ {
+ {
+ {
+ {
+ switch r {
+ case 'i', 'n', 'd', 'e',
+ 'n', 't', 'e', 'd':
+ }
+ }
+ }
+ }
+ }
+ }
+}