speculoos icon indicating copy to clipboard operation
speculoos copied to clipboard

Implement soft assertion

Open oknozor opened this issue 2 years ago • 1 comments

it would be nice to have soft assertions.

The API could look like this :

   let softly = SoftAssertions::new();
   softly.assert_that(mansion.guests()).as("Living guest").is_equal_to(7);
   softly.assert_that(mansion.kitchen()).as("Kitchen").is_equal_to("clean");
   softly.asser_that(mansion.library()).as("Library").is_equal_to("clean");
   softly.assert_all();

resulting in the following :

 1) [Living Guests] expected:<[7]> but was:<[6]>
 2) [Library] expected:<"clean"> but was:<"messy">
 3) [Kitchen] expected:<"clean"> but was:<"dirty">

oknozor avatar Nov 06 '21 09:11 oknozor