Skip to content

XCTest inverses "Actual" and "Expected" values #1441

@belaspahn

Description

@belaspahn

Describe the bug
'expected' and 'actual' are matched in the wrong order from the message regex matches. The colouring of red and green seem to be displayed correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Run a Test from within VSCode window
  2. Click on a red flagged issue for any XCTAssertEqual() to unfold details
  3. Notice the mislabelling of "Expected" and "Actual"

Expected behavior
To be displayed correctly

Environment

  • OS: macOS 15.3.2
  • Swift version: 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
  • Visual Studio Code version: 1.98.1
  • vscode-swift version: 2.0.2 (last updated 2025-03-16, 18:15:03)

Additional context
Potential location of bug:

File: /src/TestExplorer/TestParsers/XCTestOutputParser.ts

private extractDiff(message: string): TestIssueDiff | undefined {
    const regex = /\((.*)\) is not .* to \((.*)\)/ms;
    const match = message.match(regex);
    if (match && match[1] !== match[2]) {
        return {
            expected: match[1],
            actual: match[2],
        };
    }

    return undefined;
}

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions