@@ -509,15 +509,7 @@ final class BackgroundIndexingTests: XCTestCase {
509
509
510
510
// clangd might have Header.h open, which prevents us from updating it. Keep retrying until we get a successful
511
511
// 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) )
521
513
522
514
project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: uri, type: . changed) ] ) )
523
515
try await project. testClient. send ( PollIndexRequest ( ) )
@@ -1254,10 +1246,10 @@ final class BackgroundIndexingTests: XCTestCase {
1254
1246
1255
1247
// Just committing a new version of the dependency shouldn't change anything because we didn't update the package
1256
1248
// dependencies.
1257
- try """
1249
+ try await """
1258
1250
/// Do something v1.1.0
1259
1251
public func doSomething() {}
1260
- """ . write ( to: dependencySwiftURL, atomically : true , encoding : . utf8 )
1252
+ """ . writeWithRetry ( to: dependencySwiftURL)
1261
1253
try await dependencyProject. tag ( changedFiles: [ dependencySwiftURL] , version: " 1.1.0 " )
1262
1254
1263
1255
let hoverAfterNewVersionCommit = try await project. testClient. send (
@@ -1403,7 +1395,7 @@ final class BackgroundIndexingTests: XCTestCase {
1403
1395
return value
1404
1396
}
1405
1397
"""
1406
- try newLibAContents. write ( to: XCTUnwrap ( uri. fileURL) , atomically : true , encoding : . utf8 )
1398
+ try await newLibAContents. writeWithRetry ( to: XCTUnwrap ( uri. fileURL) )
1407
1399
project. testClient. send (
1408
1400
DidOpenTextDocumentNotification (
1409
1401
textDocument: TextDocumentItem ( uri: uri, language: . swift, version: 0 , text: newLibAContents)
@@ -1590,7 +1582,7 @@ final class BackgroundIndexingTests: XCTestCase {
1590
1582
}
1591
1583
"""
1592
1584
)
1593
- try newAContents. write ( to: XCTUnwrap ( libAUri. fileURL) , atomically : true , encoding : . utf8 )
1585
+ try await newAContents. writeWithRetry ( to: XCTUnwrap ( libAUri. fileURL) )
1594
1586
1595
1587
project. testClient. send (
1596
1588
DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] )
@@ -1645,11 +1637,11 @@ final class BackgroundIndexingTests: XCTestCase {
1645
1637
XCTAssertEqual ( completionBeforeEdit. items. map ( \. label) , [ " self " ] )
1646
1638
1647
1639
let libAUri = try project. uri ( for: " LibA.swift " )
1648
- try """
1640
+ try await """
1649
1641
public struct LibA {
1650
1642
public func test() {}
1651
1643
}
1652
- """ . write ( to: XCTUnwrap ( libAUri. fileURL) , atomically : true , encoding : . utf8 )
1644
+ """ . writeWithRetry ( to: XCTUnwrap ( libAUri. fileURL) )
1653
1645
1654
1646
project. testClient. send (
1655
1647
DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] )
@@ -1708,7 +1700,7 @@ final class BackgroundIndexingTests: XCTestCase {
1708
1700
)
1709
1701
1710
1702
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) )
1712
1704
project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: libAUri, type: . changed) ] ) )
1713
1705
1714
1706
try await repeatUntilExpectedResult {
0 commit comments