From b932f78fba2507f6d238d5586fd61ba17335ae8e Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Fri, 5 Sep 2025 15:00:59 -0500 Subject: [PATCH] Update one more test --- .../OnTypeFormattingTests.swift | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Tests/SourceKitLSPTests/OnTypeFormattingTests.swift b/Tests/SourceKitLSPTests/OnTypeFormattingTests.swift index 69e4600a..fb287bb4 100644 --- a/Tests/SourceKitLSPTests/OnTypeFormattingTests.swift +++ b/Tests/SourceKitLSPTests/OnTypeFormattingTests.swift @@ -54,15 +54,13 @@ final class OnTypeFormattingTests: XCTestCase { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) - let positions = testClient.openDocument( - """ + let source = """ func foo() { 1️⃣if let SomeReallyLongVar = 2️⃣ 3️⃣Some.More.Stuff(), let a = 4️⃣ 5️⃣myfunc() 6️⃣{ } } - """, - uri: uri - ) + """ + let positions = testClient.openDocument(source, uri: uri) let response = try await testClient.send( DocumentOnTypeFormattingRequest( @@ -74,13 +72,18 @@ final class OnTypeFormattingTests: XCTestCase { ) let edits = try XCTUnwrap(response) + let (_, unmarkedSource) = extractMarkers(source) + let formattedSource = unmarkedSource.applying(edits) + XCTAssertEqual( - edits, - [ - TextEdit(range: Range(positions["1️⃣"]), newText: " "), - TextEdit(range: positions["2️⃣"]..