@@ -114,23 +114,25 @@ final class SwiftInterfaceTests: XCTestCase {
114
114
_ testLoc: TestLocation ,
115
115
ws: SKSwiftPMTestWorkspace ,
116
116
swiftInterfaceFile: String ,
117
- linePrefix: String
117
+ linePrefix: String ,
118
+ file: StaticString = #filePath,
119
+ line: UInt = #line
118
120
) throws {
119
121
try ws. openDocument ( testLoc. url, language: . swift)
120
122
let definition = try ws. sk. sendSync ( DefinitionRequest (
121
123
textDocument: testLoc. docIdentifier,
122
124
position: testLoc. position) )
123
125
guard case . locations( let jump) = definition else {
124
- XCTFail ( " Response is not locations " )
126
+ XCTFail ( " Response is not locations " , file : file , line : line )
125
127
return
126
128
}
127
- let location = try XCTUnwrap ( jump. first)
128
- XCTAssertTrue ( location. uri. pseudoPath. hasSuffix ( swiftInterfaceFile) , " Path was: '\( location. uri. pseudoPath) ' " )
129
+ let location = try XCTUnwrap ( jump. first, " No locations " , file : file , line : line )
130
+ XCTAssertTrue ( location. uri. pseudoPath. hasSuffix ( swiftInterfaceFile) , " Expected ' \( swiftInterfaceFile ) ' but returned path was '\( location. uri. pseudoPath) ' " , file : file , line : line )
129
131
// load contents of swiftinterface
130
- let contents = try XCTUnwrap ( location. uri. fileURL. flatMap ( { try String ( contentsOf: $0, encoding: . utf8) } ) )
132
+ let contents = try XCTUnwrap ( location. uri. fileURL. flatMap ( { try String ( contentsOf: $0, encoding: . utf8) } ) , " Missing path " , file : file , line : line )
131
133
let lineTable = LineTable ( contents)
132
- let line = lineTable [ location. range. lowerBound. line]
133
- XCTAssert ( line . hasPrefix ( linePrefix) , " Full line was: '\( line ) ' " )
134
+ let lineText = lineTable [ location. range. lowerBound. line]
135
+ XCTAssert ( lineText . hasPrefix ( linePrefix) , " Expected ' \( linePrefix ) ' but first line was '\( lineText ) ' " , file : file , line : line )
134
136
ws. closeDocument ( testLoc. url)
135
137
}
136
138
0 commit comments