Skip to content

chore: test cleanup#117

Merged
Chris-Wolfgang merged 1 commit into
mainfrom
chore/test-cleanup
May 11, 2026
Merged

chore: test cleanup#117
Chris-Wolfgang merged 1 commit into
mainfrom
chore/test-cleanup

Conversation

@Chris-Wolfgang
Copy link
Copy Markdown
Owner

Summary

  • Remove unused #pragma warning disable IDE0022 from ResultTests.cs.
  • Convert tab indentation to 4 spaces in RunAsyncFuncTests.cs to match the rest of the test project.
  • Remove redundant inheritance-verification tests from ResultOfTTests (AllSucceeded / AnyFailed / Flatten accessed via Result<int>.). These only exercised C# static-member inheritance, which is a language feature.
  • Migrate the multi-failure Flatten assertion (the one case that wasn't also in ResultTests) into ResultTests so coverage is preserved.

Test count: 97 → 82 (16 redundant tests removed, 1 added).

Test plan

  • dotnet build -c Release — 0 warnings, 0 errors
  • dotnet test -c Release --framework net8.0 — 82/82 passing
  • CI green across all TFMs
  • Coverage gate still ≥90% (the removed tests were duplicates so coverage should be unchanged)

🤖 Generated with Claude Code

- Remove unused `#pragma warning disable IDE0022` from ResultTests.cs.
- Convert tab indentation to 4 spaces in RunAsyncFuncTests.cs to match
  the rest of the test project.
- Remove redundant inheritance-verification tests from ResultOfTTests
  (AllSucceeded / AnyFailed / Flatten via `Result<int>.`). These just
  exercised C# static-member inheritance, which is a language feature.
  The actual logic is already covered in ResultTests.
- Migrate the multi-failure Flatten test (the one case that wasn't
  also in ResultTests) into ResultTests so coverage is preserved.

Test count: 97 -> 82 (16 redundant tests removed, 1 added).
All tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 11, 2026 16:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs test-suite cleanup for the Try-Pattern C# library by removing redundant/unused test code and aligning formatting, while preserving coverage for the only non-duplicated Result.Flatten multi-failure case.

Changes:

  • Normalized indentation in RunAsyncFuncTests.cs (tabs → 4 spaces).
  • Removed an unused #pragma warning disable IDE0022 from ResultTests.cs and added a dedicated multi-failure Flatten assertion there.
  • Deleted redundant Result<int>.AllSucceeded/AnyFailed/Flatten tests from ResultOfTTests.cs (they duplicated ResultTests coverage and only exercised static-member access via the derived type).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs Formatting-only change to match test-project indentation conventions.
tests/Wolfgang.TryPattern.Tests/ResultTests.cs Removes unused pragma and adds multi-failure Flatten assertion using the library’s "\n" join behavior.
tests/Wolfgang.TryPattern.Tests/ResultOfTTests.cs Removes redundant static-member access tests and leaves an explanatory note to avoid reintroducing them.

@Chris-Wolfgang Chris-Wolfgang merged commit 1feee38 into main May 11, 2026
12 checks passed
@Chris-Wolfgang Chris-Wolfgang deleted the chore/test-cleanup branch May 11, 2026 21:20
@Chris-Wolfgang Chris-Wolfgang mentioned this pull request May 18, 2026
4 tasks
Chris-Wolfgang added a commit that referenced this pull request May 19, 2026
Changes since v0.3.1:

- fix: null-element validation in Result.Flatten / AllSucceeded /
  AnyFailed (#113) — previously calling `.Failed` on a null element
  threw NullReferenceException; now throws ArgumentException with the
  index of the offending element. Adds [NotNull] post-condition
  attribute to all three methods plus all Try.Run/RunAsync overloads.
  Polyfills NotNullAttribute for net462 / netstandard2.0.
- perf: Result.Success() now returns a cached singleton instead of
  allocating per call (#114). Behavior is locked in by a test using
  Assert.Same; XML docs warn callers not to rely on reference identity.
- perf: replace LINQ in Flatten / AllSucceeded / AnyFailed with index-
  based for-loops (#116). Flatten is now single-pass with a lazy
  StringBuilder so the common single-failure case has zero extra
  allocation. AllSucceeded / AnyFailed short-circuit on first
  failure, so a trailing null past the decisive element no longer
  throws (documented in <exception> XML and locked in by tests).
- refactor: simplify Result ctor validation (#115) — switch-when
  replaced with two guard-clause ifs. No behavior change; exception
  messages and ParamName preserved.
- chore: test cleanup (#117) — remove redundant inheritance-
  verification tests, fix tabs vs spaces, drop unused pragma.
- chore(deps): Bump Meziantou.Analyzer 3.0.77 → 3.0.85 (#118).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants