Skip to content

Commit a4da9bf

Browse files
authored
Swap expected and actual assertion values (#1444)
The values of the error message in the VS Code UI is swapped from how they appear in XCTAssertEqual. Issue: #1441
1 parent 1bd8acc commit a4da9bf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/TestExplorer/TestParsers/XCTestOutputParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ export class XCTestOutputParser implements IXCTestOutputParser {
462462
const match = message.match(regex);
463463
if (match && match[1] !== match[2]) {
464464
return {
465-
expected: match[1],
466-
actual: match[2],
465+
actual: match[1],
466+
expected: match[2],
467467
};
468468
}
469469

test/integration-tests/testexplorer/XCTestOutputParser.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ Test Case '-[MyTests.MyTests testFail]' failed (0.106 seconds).
165165
),
166166
isKnown: false,
167167
diff: {
168-
expected: '"1"',
169-
actual: '"2"',
168+
actual: '"1"',
169+
expected: '"2"',
170170
},
171171
},
172172
],
@@ -485,7 +485,7 @@ Test Suite 'Selected tests' failed at 2024-10-20 22:01:46.306.
485485
});
486486

487487
suite("Diffs", () => {
488-
const testRun = (message: string, expected?: string, actual?: string) => {
488+
const testRun = (message: string, actual?: string, expected?: string) => {
489489
const input = `Test Case '-[MyTests.MyTests testFail]' started.
490490
/Users/user/Developer/MyTests/MyTests.swift:59: error: -[MyTests.MyTests testFail] : ${message}
491491
Test Case '-[MyTests.MyTests testFail]' failed (0.106 seconds).
@@ -589,8 +589,8 @@ Test Case 'MyTests.testFail' failed (0.106 seconds).
589589
),
590590
isKnown: false,
591591
diff: {
592-
expected: '"1"',
593-
actual: '"2"',
592+
actual: '"1"',
593+
expected: '"2"',
594594
},
595595
},
596596
],

0 commit comments

Comments
 (0)