@@ -509,15 +509,7 @@ final class BackgroundIndexingTests: XCTestCase {
509509
510510 // clangd might have Header.h open, which prevents us from updating it. Keep retrying until we get a successful
511511 // write. This matches what a user would do.
512- try await repeatUntilExpectedResult {
513- do {
514- try headerNewMarkedContents. write ( to: try XCTUnwrap ( uri. fileURL) , atomically: true , encoding: . utf8)
515- return true
516- } catch {
517- logger. error ( " Writing new Header.h failed, will retry: \( error. forLogging) " )
518- return false
519- }
520- }
512+ try await headerNewMarkedContents. writeWithRetry ( to: try XCTUnwrap ( uri. fileURL) )
521513
522514 project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: uri, type: . changed) ] ) )
523515 try await project. testClient. send ( PollIndexRequest ( ) )
@@ -1254,10 +1246,10 @@ final class BackgroundIndexingTests: XCTestCase {
12541246
12551247 // Just committing a new version of the dependency shouldn't change anything because we didn't update the package
12561248 // dependencies.
1257- try """
1249+ try await """
12581250 /// Do something v1.1.0
12591251 public func doSomething() {}
1260- """ . write ( to: dependencySwiftURL, atomically : true , encoding : . utf8 )
1252+ """ . writeWithRetry ( to: dependencySwiftURL)
12611253 try await dependencyProject. tag ( changedFiles: [ dependencySwiftURL] , version: " 1.1.0 " )
12621254
12631255 let hoverAfterNewVersionCommit = try await project. testClient. send (
@@ -1403,7 +1395,7 @@ final class BackgroundIndexingTests: XCTestCase {
14031395 return value
14041396 }
14051397 """
1406- try newLibAContents. write ( to: XCTUnwrap ( uri. fileURL) , atomically : true , encoding : . utf8 )
1398+ try await newLibAContents. writeWithRetry ( to: XCTUnwrap ( uri. fileURL) )
14071399 project. testClient. send (
14081400 DidOpenTextDocumentNotification (
14091401 textDocument: TextDocumentItem ( uri: uri, language: . swift, version: 0 , text: newLibAContents)
@@ -1590,7 +1582,7 @@ final class BackgroundIndexingTests: XCTestCase {
15901582 }
15911583 """
15921584 )
1593- try newAContents. write ( to: XCTUnwrap ( libAUri. fileURL) , atomically : true , encoding : . utf8 )
1585+ try await newAContents. writeWithRetry ( to: XCTUnwrap ( libAUri. fileURL) )
15941586
15951587 project. testClient. send (
15961588 DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] )
@@ -1645,11 +1637,11 @@ final class BackgroundIndexingTests: XCTestCase {
16451637 XCTAssertEqual ( completionBeforeEdit. items. map ( \. label) , [ " self " ] )
16461638
16471639 let libAUri = try project. uri ( for: " LibA.swift " )
1648- try """
1640+ try await """
16491641 public struct LibA {
16501642 public func test() {}
16511643 }
1652- """ . write ( to: XCTUnwrap ( libAUri. fileURL) , atomically : true , encoding : . utf8 )
1644+ """ . writeWithRetry ( to: XCTUnwrap ( libAUri. fileURL) )
16531645
16541646 project. testClient. send (
16551647 DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] )
@@ -1708,7 +1700,7 @@ final class BackgroundIndexingTests: XCTestCase {
17081700 )
17091701
17101702 let libAUri = try project. uri ( for: " LibA.swift " )
1711- try " public let myVar: Int " . write ( to: try XCTUnwrap ( libAUri. fileURL) , atomically : true , encoding : . utf8 )
1703+ try await " public let myVar: Int " . writeWithRetry ( to: try XCTUnwrap ( libAUri. fileURL) )
17121704 project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] ) )
17131705
17141706 try await repeatUntilExpectedResult {
0 commit comments