Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix Should optional overload generation - #5820

#5820
Merged
thomhurst merged 1 commit into
mainthomhurst/TUnit:mainfrom
fix/should-generate-optional-overloadsthomhurst/TUnit:fix/should-generate-optional-overloadsCopy head branch name to clipboard
May 2, 2026
Merged

Fix Should optional overload generation#5820
thomhurst merged 1 commit into
mainthomhurst/TUnit:mainfrom
fix/should-generate-optional-overloadsthomhurst/TUnit:fix/should-generate-optional-overloadsCopy head branch name to clipboard

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

  • Allow the Should source generator to wrap overloads whose assertion constructors have safe trailing optional defaults.
  • Add regression coverage for Should().Throw<T>().WithMessage("...") without StringComparison.
  • Update Should public API snapshots for the newly generated overloads.

Verification

  • TUnit.Assertions.Should.SourceGenerator.Tests regression on net8.0, net9.0, net10.0
  • TUnit.Assertions.Should.Tests regression on net8.0, net9.0, net10.0
  • TUnit.PublicAPI Should snapshot on net8.0, net9.0, net10.0 with TUNIT_OTEL_RECEIVER=0
  • git diff --check

Closes #5818

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity

Metric Results
Complexity 5

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@thomhurst
thomhurst enabled auto-merge (squash) May 2, 2026 20:49
@thomhurst
thomhurst merged commit 246d59f into main May 2, 2026
12 of 13 checks passed
@thomhurst
thomhurst deleted the fix/should-generate-optional-overloads branch May 2, 2026 21:18
This was referenced May 2, 2026
This was referenced Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TUnit.Assertions.Should requires a StringComparison for Throws().WithMessage

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.