Update one more test

This commit is contained in:
Nate Cook
2025-09-05 15:00:59 -05:00
parent 03431b8739
commit b932f78fba

View File

@@ -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"]..<positions["3"], newText: ""),
TextEdit(range: positions["4"]..<positions["5"], newText: ""),
]
formattedSource,
"""
func foo() {
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
}
}
"""
)
}