Skip to content

feat!: provide constructor functions for expectations#55

Merged
haraldmaida merged 2 commits into
mainfrom
feat/dsl-like-contructor-functions-for-expectations
Jun 22, 2025
Merged

feat!: provide constructor functions for expectations#55
haraldmaida merged 2 commits into
mainfrom
feat/dsl-like-contructor-functions-for-expectations

Conversation

@haraldmaida
Copy link
Copy Markdown
Member

@haraldmaida haraldmaida commented Jun 22, 2025

When composing custom expectations using the expectations combinators (not, all, any) it should be possible to construct the expectations in a convenient and readable form. Therefore we should provide constructor functions for expectations, e.g.

instead of :

let custom_expectation = all((not(IsZero), IsAtLeast { expected: -40 }, IsAtMost { expected: 100 }));

we can write:

let custom_expectation = all((not(is_zero()), is_at_least(-40), is_at_most(100)));

Implemented a constructor function for each of the provided expectations.

BREAKING CHANGES:

  • the existing constructor functions new of the expectation structs have been marked as deprecated and will be removed in some later release.

@haraldmaida haraldmaida self-assigned this Jun 22, 2025
@haraldmaida haraldmaida added the enhancement New feature or request label Jun 22, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 98.80000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.84%. Comparing base (9119cda) to head (2b28758).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/expectations.rs 98.34% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
- Coverage   96.30%   93.84%   -2.47%     
==========================================
  Files          32       32              
  Lines        4227     4546     +319     
  Branches     4227     4546     +319     
==========================================
+ Hits         4071     4266     +195     
- Misses        110      234     +124     
  Partials       46       46              

☔ View full report in Codecov by Sentry.
📢 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 eeceab3 into main Jun 22, 2025
19 of 20 checks passed
@haraldmaida haraldmaida deleted the feat/dsl-like-contructor-functions-for-expectations branch June 22, 2025 09:22
@haraldmaida haraldmaida changed the title feat: provide constructor functions for expectations feat!: provide constructor functions for expectations Jun 28, 2025
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