swiftlang / swift-corelibs-xctest

The XCTest Project, A Swift core library for providing unit test support
swift.org
Apache License 2.0
1.15k stars 267 forks source link

Parsing multi-line messages from XCTFail can produce inaccurate results #425

Closed adam-fowler closed 1 year ago

adam-fowler commented 1 year ago

It is very hard to identify when an XCTFail message finishes in the output from XCTest.

The following test

func testXCTFail() {
    XCTFail("""
    Test
    Failed
    """)
    print("Hello")
}

produces the following output

Test Case 'AppTests.testXCTFail' started at 2023-01-14 12:38:26.859
/workspaces/Tests/AppTests/AppTests.swift:21: error: AppTests.testFail : failed - Test
Failed
Hello
Test Case 'AppTests.testFail' failed (0.006 seconds)

There is no way from this output to ascertain where the fail message ends.

This is an issue for the VSCode Swift extension when parsing XCTest output to update the TestExplorer

swift --version output

Swift version 5.8-dev (LLVM 170e2cfa496ad7c, Swift f32ae6f8c6068cd) Target: aarch64-unknown-linux-gnu

This is an issue on all platforms

grynspan commented 1 year ago

Duplicate of #361