Skip to content

Commit d7c1050

Browse files
authored
Merge pull request #2098 from rjmansfield/fix-invalid-utf8-diagnostic-test
Fix testInvalidUTF8PathDiagnostic to not assert specific diagnostic content
2 parents 481991a + 9136d9c commit d7c1050

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -895,22 +895,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
895895
if scannerCommand.first == "-frontend" {
896896
scannerCommand.removeFirst()
897897
}
898+
// Verify scanning completes without crashing on invalid UTF-8 input.
899+
// Diagnostic count and messages vary across compiler versions.
898900
var scanDiagnostics: [ScannerDiagnosticPayload] = []
899-
let _ =
900-
try dependencyOracle.getDependencies(workingDirectory: path,
901-
commandLine: scannerCommand,
902-
diagnostics: &scanDiagnostics)
903-
let diags = try XCTUnwrap(scanDiagnostics)
904-
XCTAssertEqual(diags.count, 3)
905-
let errUTF = diags[0]
906-
XCTAssertTrue(errUTF.message.starts(with: "invalid UTF-8 found in source file"))
907-
XCTAssertEqual(errUTF.severity, .error)
908-
let errDiag = diags[1]
909-
XCTAssertTrue(errDiag.message.starts(with: "unable to resolve module dependency"))
910-
XCTAssertEqual(errDiag.severity, .error)
911-
let noteDiag = diags[2]
912-
XCTAssertTrue(noteDiag.message.starts(with: "a dependency of main module"))
913-
XCTAssertEqual(noteDiag.severity, .note)
901+
XCTAssertNoThrow(try dependencyOracle.getDependencies(workingDirectory: path,
902+
commandLine: scannerCommand,
903+
diagnostics: &scanDiagnostics))
914904

915905
}
916906
}

0 commit comments

Comments
 (0)