@@ -87,41 +87,20 @@ final class SwiftInterfaceTests: XCTestCase {
87
87
try ws. buildAndIndex ( )
88
88
let importedModule = ws. testLoc ( " lib:import " )
89
89
try ws. openDocument ( importedModule. url, language: . swift)
90
- let workspace = try XCTUnwrap ( ws. testServer. server? . queue. sync {
91
- try XCTUnwrap ( ws. testServer. server? . workspaceForDocument ( uri: importedModule. docUri) )
92
- } )
93
- let swiftLangServer = try XCTUnwrap ( ws. testServer. server? . _languageService ( for: importedModule. docUri, . swift, in: workspace) )
94
- let expectation = expectation ( description: " open interface request " )
95
90
let openInterface = OpenInterfaceRequest ( textDocument: importedModule. docIdentifier, name: " lib " )
96
- let request = Request ( openInterface, id: . number( 1 ) , clientID: ObjectIdentifier ( swiftLangServer) ,
97
- cancellation: CancellationToken ( ) , reply: { ( result: Result < OpenInterfaceRequest . Response , ResponseError > ) in
98
- do {
99
- let interfaceDetails = try result. get ( )
100
- XCTAssertTrue ( interfaceDetails. uri. pseudoPath. hasSuffix ( " /lib.swiftinterface " ) )
101
- let fileContents = try XCTUnwrap ( interfaceDetails. uri. fileURL. flatMap ( { try String ( contentsOf: $0, encoding: . utf8) } ) )
102
- XCTAssertTrue ( fileContents. contains ( """
91
+ let interfaceDetails = try XCTUnwrap ( ws. sk. sendSync ( openInterface) )
92
+ XCTAssertTrue ( interfaceDetails. uri. pseudoPath. hasSuffix ( " /lib.swiftinterface " ) )
93
+ let fileContents = try XCTUnwrap ( interfaceDetails. uri. fileURL. flatMap ( { try String ( contentsOf: $0, encoding: . utf8) } ) )
94
+ XCTAssertTrue ( fileContents. contains ( """
103
95
public struct Lib {
104
-
96
+
105
97
public func foo()
106
-
98
+
107
99
public init()
108
100
}
109
101
""" ) )
110
- } catch {
111
- XCTFail ( error. localizedDescription)
112
- }
113
- expectation. fulfill ( )
114
- } )
115
-
116
- // Send an arbitrary request through the front door first or SourceKitServer won't be properly initialized.
117
- _ = try ws. sk. sendSync ( HoverRequest (
118
- textDocument: importedModule. docIdentifier,
119
- position: importedModule. position) )
120
- swiftLangServer. openInterface ( request)
121
-
122
- waitForExpectations ( timeout: 15 )
123
102
}
124
-
103
+
125
104
func testSwiftInterfaceAcrossModules( ) throws {
126
105
guard let ws = try staticSourceKitSwiftPMWorkspace ( name: " SwiftPMPackage " ) else { return }
127
106
try ws. buildAndIndex ( )
0 commit comments