Skip to content

Commit cef4e6c

Browse files
authored
Fix swift-testing Runs parameterized test on nightly toolchains (#1459)
The format of the ID used by parameterized test cases has changed recently in the nightly (6.2) toolchains. This ID doesn't matter much to the extension, it just needs to be unique, so only the tests need to be updated. Issue: #1458
1 parent 61f8df7 commit cef4e6c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Diff for: test/integration-tests/testexplorer/TestExplorerIntegration.test.ts

+19-4
Original file line numberDiff line numberDiff line change
@@ -631,11 +631,26 @@ suite("Test Explorer Suite", function () {
631631
const testId = "PackageTests.parameterizedTest(_:)";
632632
const testRun = await runTest(testExplorer, runProfile, testId);
633633

634-
assertTestResults(testRun, {
635-
passed: [
634+
let passed: string[];
635+
let failedId: string;
636+
if (
637+
workspaceContext.swiftVersion.isGreaterThanOrEqual(new Version(6, 2, 0))
638+
) {
639+
passed = [
640+
`${testId}/PackageTests.swift:59:2/Parameterized test case ID: argumentIDs: [Testing.Test.Case.Argument.ID(bytes: [49])], discriminator: 0, isStable: true`,
641+
`${testId}/PackageTests.swift:59:2/Parameterized test case ID: argumentIDs: [Testing.Test.Case.Argument.ID(bytes: [51])], discriminator: 0, isStable: true`,
642+
];
643+
failedId = `${testId}/PackageTests.swift:59:2/Parameterized test case ID: argumentIDs: [Testing.Test.Case.Argument.ID(bytes: [50])], discriminator: 0, isStable: true`;
644+
} else {
645+
passed = [
636646
`${testId}/PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [49])])`,
637647
`${testId}/PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [51])])`,
638-
],
648+
];
649+
failedId = `${testId}/PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [50])])`;
650+
}
651+
652+
assertTestResults(testRun, {
653+
passed,
639654
failed: [
640655
{
641656
issues: [
@@ -644,7 +659,7 @@ suite("Test Explorer Suite", function () {
644659
text: "Expectation failed: (arg → 2) != 2",
645660
})}`,
646661
],
647-
test: `${testId}/PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [50])])`,
662+
test: failedId,
648663
},
649664
{
650665
issues: [],

0 commit comments

Comments
 (0)