Skip to content

Translate HTTPHeaderValidationTests to Swift testing - #3579

Merged
fabianfett merged 3 commits into
apple:mainfrom
fabianfett:ff-translate-HTTPRequestValidationTests-to-swift-testing
Apr 21, 2026
Merged

fabianfett merged 3 commits into
apple:mainfrom
fabianfett:ff-translate-HTTPRequestValidationTests-to-swift-testing

Conversation

@fabianfett

Copy link
Copy Markdown
Member

Translate HTTPHeaderValidationTests to Swift testing

Motivation:

We want to add tests that use parameterized testing to HTTPHeaderValidationTests. In order to allow this we first need to translate this file to use Swift Testing instead of XCTest.

Modifications:

  • Mechanical translation of HTTPHeaderValidationTests from XCTest to Swift testing.

Result:

We can add parameterized tests to HTTPHeaderValidationTests.

@fabianfett fabianfett added the semver/none No version bump required. label Apr 21, 2026

@simonjbeaumont simonjbeaumont left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Up to you whether we put the explicit failure message back in for those few asserts that had them β€” they dropped off when moving to the Swift Testing equivalents.


XCTAssertThrowsError(
try channel.writeOutbound(HTTPServerResponsePart.head(badResponse)),
"Incorrectly tolerated character in header field value: \(String(decoding: [byte], as: UTF8.self))"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost the explicit message here when this expectation is not met, and in a few other places.

@fabianfett
fabianfett force-pushed the ff-translate-HTTPRequestValidationTests-to-swift-testing branch from 1cc9072 to 2a46892 Compare April 21, 2026 14:23
@fabianfett
fabianfett merged commit a57cc53 into apple:main Apr 21, 2026
50 of 53 checks passed
@fabianfett
fabianfett deleted the ff-translate-HTTPRequestValidationTests-to-swift-testing branch April 21, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants