Skip to content

Commit b2526c0

Browse files
committed
Revert "(Temporary) Remove unit test"
This reverts commit 19491c9.
1 parent 25c5a52 commit b2526c0

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,95 @@ final class BackgroundIndexingTests: XCTestCase {
26262626
}
26272627
}
26282628

2629+
// WIP, not ready for review
2630+
// func testBuildServerUsesCustomTaskBatchSize() async throws {
2631+
// final class BuildServer: CustomBuildServer {
2632+
// let inProgressRequestsTracker = CustomBuildServerInProgressRequestTracker()
2633+
// private let projectRoot: URL
2634+
// private var testFileURL: URL { projectRoot.appendingPathComponent("test.swift").standardized }
2635+
2636+
// nonisolated(unsafe) var preparedTargetBatches = [[BuildTargetIdentifier]]()
2637+
2638+
// required init(projectRoot: URL, connectionToSourceKitLSP: any LanguageServerProtocol.Connection) {
2639+
// self.projectRoot = projectRoot
2640+
// }
2641+
2642+
// func initializeBuildRequest(_ request: InitializeBuildRequest) async throws -> InitializeBuildResponse {
2643+
// return try initializationResponseSupportingBackgroundIndexing(
2644+
// projectRoot: projectRoot,
2645+
// outputPathsProvider: false,
2646+
// )
2647+
// }
2648+
2649+
// func buildTargetSourcesRequest(_ request: BuildTargetSourcesRequest) async throws -> BuildTargetSourcesResponse {
2650+
// var dummyTargets = [BuildTargetIdentifier]()
2651+
// for i in 0..<10 {
2652+
// dummyTargets.append(BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-\(i)")))
2653+
// }
2654+
// return BuildTargetSourcesResponse(items: dummyTargets.map {
2655+
// SourcesItem(target: $0, sources: [SourceItem(uri: URI(testFileURL), kind: .file, generated: false)])
2656+
// })
2657+
// }
2658+
2659+
// func textDocumentSourceKitOptionsRequest(
2660+
// _ request: TextDocumentSourceKitOptionsRequest
2661+
// ) async throws -> TextDocumentSourceKitOptionsResponse? {
2662+
// return TextDocumentSourceKitOptionsResponse(compilerArguments: [request.textDocument.uri.pseudoPath])
2663+
// }
2664+
2665+
// func prepareTarget(_ request: BuildTargetPrepareRequest) async throws -> VoidResponse {
2666+
// preparedTargetBatches.append(request.targets.sorted { $0.uri.stringValue < $1.uri.stringValue })
2667+
// return VoidResponse()
2668+
// }
2669+
// }
2670+
2671+
// let project = try await CustomBuildServerTestProject(
2672+
// files: [
2673+
// "test.swift": """
2674+
// func testFunction() {}
2675+
// """
2676+
// ],
2677+
// buildServer: BuildServer.self,
2678+
// enableBackgroundIndexing: true,
2679+
// )
2680+
2681+
// // Wait for indexing to finish without elevating the priority
2682+
// // Otherwise, task re-scheduling would cause the test to become flaky
2683+
// let semaphore = WrappedSemaphore(name: "Indexing finished")
2684+
// let testClient = project.testClient
2685+
// Task(priority: .low) {
2686+
// await assertNoThrow {
2687+
// try await testClient.send(SynchronizeRequest(index: true))
2688+
// }
2689+
// semaphore.signal()
2690+
// }
2691+
// try semaphore.waitOrThrow()
2692+
2693+
// let buildServer = try project.buildServer()
2694+
// let preparedBatches = buildServer.preparedTargetBatches.sorted { $0[0].uri.stringValue < $1[0].uri.stringValue }
2695+
// XCTAssertEqual(preparedBatches, [
2696+
// [
2697+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-0")),
2698+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-1")),
2699+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-2")),
2700+
// ],
2701+
// [
2702+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-3")),
2703+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-4")),
2704+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-5")),
2705+
// ],
2706+
// [
2707+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-6")),
2708+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-7")),
2709+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-8")),
2710+
// ],
2711+
// [
2712+
// BuildTargetIdentifier(uri: try! URI(string: "dummy://dummy-9")),
2713+
// ]
2714+
// ])
2715+
// }
2716+
// }
2717+
26292718
extension HoverResponseContents {
26302719
var markupContent: MarkupContent? {
26312720
switch self {

0 commit comments

Comments
 (0)