Have dumbindent preserve indent on the first line

This commit is contained in:
Nigel Tao committed 2020-07-12 09:29:48 +10:00
1 parent 229a0c5af4
commit b14e3eae9f
2 files changed
+32 -10

No files matched your search

+5 -1
View File
@@ -31,6 +31,10 @@ func TestFormatBytes(tt *testing.T) {
// Braces.
src: "foo{\nbar\n }\nbaz\n",
want: "foo{\n bar\n}\nbaz\n",
}, {
// Braces with initial indent, giving every output line +3 spaces.
src: " foo{\nbar\n }\nbaz\n",
want: " foo{\n bar\n }\n baz\n",
}, {
// Parentheses.
src: "i = (j +\nk)\np = q\n",
@@ -61,7 +65,7 @@ func TestFormatBytes(tt *testing.T) {
want: "a['key'] = `{\n\n\nX` ;\nb = {\n c = 0\n",
}, {
// Slash-star comment.
src: " a['key'] = /*{\n\n\nX*/ ; \nb = {\nc = 0\n",
src: "\n a['key'] = /*{\n\n\nX*/ ; \nb = {\nc = 0\n",
want: "a['key'] = /*{\n\n\nX*/ ;\nb = {\n c = 0\n",
}, {
// Nested blocks with label.