@@ -19,12 +19,6 @@ import (
1919// IO
2020const harnessNewLine = "\r \n "
2121
22- var (
23- lineDelimiter = regexp .MustCompile ("\r ?\n " )
24- nonWhitespace = regexp .MustCompile (`\S` )
25- tsExtension = regexp .MustCompile (`\.tsx?$` )
26- )
27-
2822var formatOpts = & compiler.DiagnosticsFormattingOptions {
2923 NewLine : harnessNewLine ,
3024}
4034 diagnosticsLocationPattern = regexp .MustCompile (`(?i)(lib.*\.d\.ts):\d+:\d+` )
4135)
4236
43- func DoErrorBaseline (t testing.TB , baselinePath string , inputFiles []* TestFile , errors []* ast.Diagnostic , pretty bool ) {
37+ func DoErrorBaseline (t * testing.T , baselinePath string , inputFiles []* TestFile , errors []* ast.Diagnostic , pretty bool ) {
4438 baselinePath = tsExtension .ReplaceAllString (baselinePath , ".errors.txt" )
4539 var errorBaseline string
4640 if len (errors ) > 0 {
@@ -61,7 +55,7 @@ func minimalDiagnosticsToString(diagnostics []*ast.Diagnostic, pretty bool) stri
6155 return output .String ()
6256}
6357
64- func getErrorBaseline (t testing.TB , inputFiles []* TestFile , diagnostics []* ast.Diagnostic , pretty bool ) string {
58+ func getErrorBaseline (t * testing.T , inputFiles []* TestFile , diagnostics []* ast.Diagnostic , pretty bool ) string {
6559 t .Helper ()
6660 outputLines := iterateErrorBaseline (t , inputFiles , diagnostics , pretty )
6761
@@ -77,7 +71,7 @@ func getErrorBaseline(t testing.TB, inputFiles []*TestFile, diagnostics []*ast.D
7771 return strings .Join (outputLines , "" )
7872}
7973
80- func iterateErrorBaseline (t testing.TB , inputFiles []* TestFile , inputDiagnostics []* ast.Diagnostic , pretty bool ) []string {
74+ func iterateErrorBaseline (t * testing.T , inputFiles []* TestFile , inputDiagnostics []* ast.Diagnostic , pretty bool ) []string {
8175 t .Helper ()
8276 diagnostics := slices .Clone (inputDiagnostics )
8377 slices .SortFunc (diagnostics , compiler .CompareDiagnostics )
@@ -225,7 +219,6 @@ func iterateErrorBaseline(t testing.TB, inputFiles []*TestFile, inputDiagnostics
225219 // Verify we didn't miss any errors in this file
226220 assert .Check (t , cmp .Equal (markedErrorCount , len (fileErrors )), "count of errors in " + inputFile .unitName )
227221 _ , isDupe := dupeCase [sanitizeTestFilePath (inputFile .unitName )]
228- checkDuplicatedFileName (inputFile .unitName , dupeCase )
229222 result = append (result , outputLines .String ())
230223 if isDupe {
231224 // Case-duplicated files on a case-insensitive build will have errors reported in both the dupe and the original
@@ -253,19 +246,6 @@ func iterateErrorBaseline(t testing.TB, inputFiles []*TestFile, inputDiagnostics
253246 return result
254247}
255248
256- func checkDuplicatedFileName (resultName string , dupeCase map [string ]int ) string {
257- resultName = sanitizeTestFilePath (resultName )
258- if _ , ok := dupeCase [resultName ]; ok {
259- // A different baseline filename should be manufactured if the names differ only in case, for windows compat
260- count := 1 + dupeCase [resultName ]
261- dupeCase [resultName ] = count
262- resultName = fmt .Sprintf ("%s.dupe%d" , resultName , count )
263- } else {
264- dupeCase [resultName ] = 0
265- }
266- return resultName
267- }
268-
269249func flattenDiagnosticMessage (d * ast.Diagnostic , newLine string ) string {
270250 var output strings.Builder
271251 compiler .WriteFlattenedDiagnosticMessage (& output , d , newLine )
0 commit comments