@@ -412,12 +412,14 @@ class PluginInvocationTests: XCTestCase {
412
412
XCTAssertEqual ( delegate. compiledResult, result)
413
413
XCTAssertNil ( delegate. cachedResult)
414
414
415
- // Check the serialized diagnostics. We should no longer have an error but now have a warning.
416
- let diaFileContents = try localFileSystem. readFileContents ( result. diagnosticsFile)
417
- let diagnosticsSet = try SerializedDiagnostics ( bytes: diaFileContents)
418
- XCTAssertEqual ( diagnosticsSet. diagnostics. count, 1 )
419
- let warningDiagnostic = try XCTUnwrap ( diagnosticsSet. diagnostics. first)
420
- XCTAssertTrue ( warningDiagnostic. text. hasPrefix ( " variable \' unused \' was never used " ) , " \( warningDiagnostic) " )
415
+ if try UserToolchain . default. supportsSerializedDiagnostics ( ) {
416
+ // Check the serialized diagnostics. We should no longer have an error but now have a warning.
417
+ let diaFileContents = try localFileSystem. readFileContents ( result. diagnosticsFile)
418
+ let diagnosticsSet = try SerializedDiagnostics ( bytes: diaFileContents)
419
+ XCTAssertEqual ( diagnosticsSet. diagnostics. count, 1 , " unexpected diagnostics count in \( diagnosticsSet. diagnostics) from \( result. diagnosticsFile. pathString) " )
420
+ let warningDiagnostic = try XCTUnwrap ( diagnosticsSet. diagnostics. first)
421
+ XCTAssertTrue ( warningDiagnostic. text. hasPrefix ( " variable \' unused \' was never used " ) , " \( warningDiagnostic) " )
422
+ }
421
423
422
424
// Check that the executable file exists.
423
425
XCTAssertTrue ( localFileSystem. exists ( result. executableFile) , " \( result. executableFile. pathString) " )
@@ -455,12 +457,14 @@ class PluginInvocationTests: XCTestCase {
455
457
XCTAssertNil ( delegate. compiledResult)
456
458
XCTAssertEqual ( delegate. cachedResult, result)
457
459
458
- // Check that the diagnostics still have the same warning as before.
459
- let diaFileContents = try localFileSystem. readFileContents ( result. diagnosticsFile)
460
- let diagnosticsSet = try SerializedDiagnostics ( bytes: diaFileContents)
461
- XCTAssertEqual ( diagnosticsSet. diagnostics. count, 1 )
462
- let warningDiagnostic = try XCTUnwrap ( diagnosticsSet. diagnostics. first)
463
- XCTAssertTrue ( warningDiagnostic. text. hasPrefix ( " variable \' unused \' was never used " ) , " \( warningDiagnostic) " )
460
+ if try UserToolchain . default. supportsSerializedDiagnostics ( ) {
461
+ // Check that the diagnostics still have the same warning as before.
462
+ let diaFileContents = try localFileSystem. readFileContents ( result. diagnosticsFile)
463
+ let diagnosticsSet = try SerializedDiagnostics ( bytes: diaFileContents)
464
+ XCTAssertEqual ( diagnosticsSet. diagnostics. count, 1 )
465
+ let warningDiagnostic = try XCTUnwrap ( diagnosticsSet. diagnostics. first)
466
+ XCTAssertTrue ( warningDiagnostic. text. hasPrefix ( " variable \' unused \' was never used " ) , " \( warningDiagnostic) " )
467
+ }
464
468
465
469
// Check that the executable file exists.
466
470
XCTAssertTrue ( localFileSystem. exists ( result. executableFile) , " \( result. executableFile. pathString) " )
0 commit comments