Skip to content

feat!: Controlling type formatting in failure reports - #96

Merged
haraldmaida merged 6 commits into
mainfrom
feat/custom-representation
Sep 5, 2026
Merged

feat!: Controlling type formatting in failure reports#96
haraldmaida merged 6 commits into
mainfrom
feat/custom-representation

Conversation

@haraldmaida

@haraldmaida haraldmaida commented Sep 5, 2026

Copy link
Copy Markdown
Member

The representation feature enables us to define how values of a certain type is represented in the failure report when an assertion fails. The representation can be defined for any type, even for foreign types without breaking the orphan rule. By default the debug representation of a type is used. If a type does not implement Debug using a custom representation is mandatory.

Breaking Change:
The API for writing custom assertions has changed. It now has an additional parameter 'representation' in many methods. Implementations of the Expectation trait should no longer require to implement Debug but instead depend on the Represent-trait.

Note: This does not break anything when using the crate for writing assertions in tests,

@haraldmaida haraldmaida self-assigned this Sep 5, 2026
@haraldmaida haraldmaida added the enhancement New feature or request label Sep 5, 2026
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.52678% with 106 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.84%. Comparing base (c747778) to head (8c4ef79).

Files with missing lines Patch % Lines
src/derived_spec/mod.rs 49.64% 71 Missing ⚠️
src/result/mod.rs 86.66% 16 Missing ⚠️
src/spec/mod.rs 91.66% 6 Missing ⚠️
src/option/mod.rs 91.52% 5 Missing ⚠️
src/range/mod.rs 82.75% 5 Missing ⚠️
src/iterator/mod.rs 99.07% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   87.73%   87.84%   +0.11%     
==========================================
  Files          42       42              
  Lines        6695     7513     +818     
  Branches     6695     7513     +818     
==========================================
+ Hits         5874     6600     +726     
- Misses        751      843      +92     
  Partials       70       70              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haraldmaida
haraldmaida merged commit 014dd4e into main Sep 5, 2026
20 checks passed
@haraldmaida
haraldmaida deleted the feat/custom-representation branch September 5, 2026 11:35
@haraldmaida haraldmaida changed the title feat!: Custom Representation feat!: Controlling type formatting in failure reports Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant