From f88ea1599d4d99c9bc7957432f7e71a9d5a04170 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 17 Aug 2023 15:51:21 -0700 Subject: [PATCH] Add a message to some test assertions The output when these assertions fail is just `XCTAssertTrue failed`, which is very unhelpful. Add in the strings we're comparing. --- Tests/SourceKitLSPTests/SwiftInterfaceTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/SourceKitLSPTests/SwiftInterfaceTests.swift b/Tests/SourceKitLSPTests/SwiftInterfaceTests.swift index 1c711ef81..d92bab9c1 100644 --- a/Tests/SourceKitLSPTests/SwiftInterfaceTests.swift +++ b/Tests/SourceKitLSPTests/SwiftInterfaceTests.swift @@ -125,12 +125,12 @@ final class SwiftInterfaceTests: XCTestCase { return } let location = try XCTUnwrap(jump.first) - XCTAssertTrue(location.uri.pseudoPath.hasSuffix(swiftInterfaceFile)) + XCTAssertTrue(location.uri.pseudoPath.hasSuffix(swiftInterfaceFile), "Path was: '\(location.uri.pseudoPath)'") // load contents of swiftinterface let contents = try XCTUnwrap(location.uri.fileURL.flatMap({ try String(contentsOf: $0, encoding: .utf8) })) let lineTable = LineTable(contents) let line = lineTable[location.range.lowerBound.line] - XCTAssert(line.hasPrefix(linePrefix)) + XCTAssert(line.hasPrefix(linePrefix), "Full line was: '\(line)'") ws.closeDocument(testLoc.url) }