mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Update one more test
This commit is contained in:
@@ -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() {
|
||||
}
|
||||
}
|
||||
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user