Migrate more end-to-end suites to Swift Testing - #951
Open
bkhouri wants to merge 1 commit into
Open
Conversation
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 22, 2026 01:46
4be63f5 to
ee095f6
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
2 times, most recently
from
August 25, 2026 03:34
8956649 to
ccc1ae0
Compare
bkhouri
marked this pull request as ready for review
August 25, 2026 03:37
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
2 times, most recently
from
August 25, 2026 03:56
7c736bd to
cde7e85
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 25, 2026 04:01
cde7e85 to
297c241
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 26, 2026 06:37
297c241 to
1adb6d1
Compare
bkhouri
commented
Aug 26, 2026
| // swift-format-ignore: AlwaysUseLowerCamelCase | ||
| // https://github.com/apple/swift-argument-parser/issues/710 | ||
| extension SubcommandEndToEndTests { | ||
| final class SubcommandEndToEndTestsXCTest: XCTestCase { |
Contributor
Author
There was a problem hiding this comment.
I'm sure how to migrate this test to Swift Testing.
@natecook1000 @rauhul: Any ideas here?
Member
There was a problem hiding this comment.
I'm not sure what exactly this is trying to test! I think we could just manually update a value in the validate() method and check that it worked. What do you think?
Contributor
Author
There was a problem hiding this comment.
The test is using XCTestExpection in SubSubCommand, which is indirectly a subcommand of BaseCommand. See right line 215.
I'm not familiar with XCTestExpectation.
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 26, 2026 07:49
1adb6d1 to
d977102
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 26, 2026 07:54
d977102 to
6590631
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 26, 2026 18:18
6590631 to
2753e72
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
2 times, most recently
from
August 27, 2026 02:47
9d711c1 to
f1fab87
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 27, 2026 15:43
f1fab87 to
206ca59
Compare
Migrate six `ArgumentParserEndToEndTests` suites from XCTest to Swift Testing: - `TransformEndToEndTests` - `OptionGroupEndToEndTests` - `ValidationEndToEndTests` - `OptionalEndToEndTests` - `PositionalEndToEndTests` - `SubcommandEndToEndTests` `OptionGroupEndToEndTests` and `SubcommandEndToEndTests` previously relied on `XCTestExpectation` via the `TestableParsableArguments`/`TestableParsableCommand` protocols. Add Swift Testing counterparts to `TestHelpers+SwiftTesting.swift`: - `TestExpectation`: a reference-typed flag that carries a `fulfilled` bool. Since ArgumentParser's parse/validate/run pipeline is synchronous, we don't need a timeout-based expectation like `XCTestExpectation`. - `TestableSwiftTestingParsableArguments` / `TestableSwiftTestingParsableCommand`: mirror the XCTest protocols; their default `validate()` / `run()` fulfill `didValidateExpectation` / `didRunExpectation`, which tests then assert with `#expect(command.didValidateExpectation.fulfilled)`. Centralizing the type means future changes (e.g. moving to `confirmation`, adding a counter, adding Sendable) touch only the helper. `ValidationEndToEndTests`'s `FooCommand.run()` contained an inline `XCTAssertEqual`; convert it to `#expect(foo == bar)` so the assertion routes through Swift Testing when run under `@Test`. `SubcommandEndToEndTests`'s `Math.run()` gets the same treatment. `PositionalEndToEndTests` keeps `disabled_parsing_BadlyFormedPositional` as an untagged method (matching the previous "not discovered" behavior of the `disabled_` prefix under XCTest); its `XCTFail` becomes `Issue.record`. Relates to #710
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_batch4
branch
from
August 27, 2026 17:07
206ca59 to
2996d0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate six
ArgumentParserEndToEndTestssuites from XCTest to SwiftTesting:
TransformEndToEndTestsOptionGroupEndToEndTestsValidationEndToEndTestsOptionalEndToEndTestsPositionalEndToEndTestsSubcommandEndToEndTestsOptionGroupEndToEndTestsandSubcommandEndToEndTestspreviouslyrelied on
XCTestExpectationvia theTestableParsableArguments/TestableParsableCommandprotocols. AddSwift Testing counterparts to
TestHelpers+SwiftTesting.swift:TestExpectation: a reference-typed flag that carries afulfilledbool. Since ArgumentParser's parse/validate/run pipeline is
synchronous, we don't need a timeout-based expectation like
XCTestExpectation.TestableSwiftTestingParsableArguments/TestableSwiftTestingParsableCommand: mirror the XCTest protocols;their default
validate()/run()fulfilldidValidateExpectation/
didRunExpectation, which tests then assert with#expect(command.didValidateExpectation.fulfilled).Centralizing the type means future changes (e.g. moving to
confirmation, adding a counter, adding Sendable) touch only thehelper.
ValidationEndToEndTests'sFooCommand.run()contained an inlineXCTAssertEqual; convert it to#expect(foo == bar)so the assertionroutes through Swift Testing when run under
@Test.SubcommandEndToEndTests'sMath.run()gets the same treatment.PositionalEndToEndTestskeepsdisabled_parsing_BadlyFormedPositionalas an untagged method(matching the previous "not discovered" behavior of the
disabled_prefix under XCTest); its
XCTFailbecomesIssue.record.Relates to #710
Checklist
Stack created with GitHub Stacks CLI • Give Feedback 💬