typelevel / weaver-test

A test framework that runs everything in parallel.
http://typelevel.org/weaver-test/
Other
30 stars 8 forks source link

forAll expectation against a fixed input set. #54

Closed LeifW closed 5 days ago

LeifW commented 6 days ago

One of the things ScalaTest has is "Table-driven property checks" - like ScalaCheck, but instead of a generator, it's just a fixed list of things to try. Or just a forAll to run an assertion against every element in a collection.

Basically, I want to run an assertion against e.g. every row of this CSV file of cities and their lat/longs, if if a row fails, get back an error message to the effect of "assertion failed for Seattle", and not the entire dataset. Does Weaver do that?

Baccata commented 5 days ago

Sort of. The Expectations construct in weaver is monoidal, so you can do something like :

import cats.syntax.all._

myList.foldMap(x => expect(...)) 

Closing the issue because it's not an issue. Please use github discussions instead if you have general questions related to the library.