Skip to content

Commit 84fbe55

Browse files
committed
remove empty lines diff
1 parent d352f27 commit 84fbe55

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

internal/fourslash/baselineutil.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (f *FourslashTest) getBaselineOptions(command baselineCommand, testPath str
126126
commandLines = append(commandLines, fixedLine)
127127
}
128128
}
129-
return strings.Join(commandLines, "\n")
129+
return strings.Join(dropTrailingEmptyLines(commandLines), "\n")
130130
},
131131
}
132132
case inlayHintsCmd:
@@ -220,7 +220,7 @@ func (f *FourslashTest) getBaselineOptions(command baselineCommand, testPath str
220220
commandLines = append(commandLines, fixedLine)
221221
}
222222
}
223-
return strings.Join(commandLines, "\n")
223+
return strings.Join(dropTrailingEmptyLines(commandLines), "\n")
224224
},
225225
DiffFixupNew: func(s string) string {
226226
lines := strings.Split(s, "\n")
@@ -292,7 +292,7 @@ func (f *FourslashTest) getBaselineOptions(command baselineCommand, testPath str
292292
}
293293
}
294294
}
295-
return strings.Join(commandLines, "\n")
295+
return strings.Join(dropTrailingEmptyLines(commandLines), "\n")
296296
},
297297
DiffFixupNew: func(s string) string {
298298
return strings.ReplaceAll(s, "bundled:///libs/", "")
@@ -305,6 +305,10 @@ func (f *FourslashTest) getBaselineOptions(command baselineCommand, testPath str
305305
}
306306
}
307307

308+
func dropTrailingEmptyLines(ss []string) []string {
309+
return ss[:core.FindLastIndex(ss, func(s string) bool { return s != "" })+1]
310+
}
311+
308312
func isSubmoduleTest(testPath string) bool {
309313
return strings.Contains(testPath, "fourslash/tests/gen") || strings.Contains(testPath, "fourslash/tests/manual")
310314
}

testdata/baselines/reference/submodule/fourslash/findRenameLocations/jsxSpreadReference.baseline.jsonc.diff

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameDefaultImportDifferentName.baseline.jsonc.diff

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/baselines/reference/submodule/fourslash/goToType/goToTypeDefinition4.baseline.jsonc.diff

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)