The assert! macro exits immediately which means it cannot usefully be used in a loop to iterate over a table of input and expected values to test a function by example.
Python (at least in PyTest) has decorators for taking a set of functions and a table of input and expected values and generating individual test function for each case.
Go takes a different attitude and say instead of using an assertion that fails have a function call that adds a failure to the fail list. This means you can write standard loops since all cases will always be tested.
I haven’t seen anything like the Go approach in the Rust testing framework, have I just missed it?
I have seen BurntSuchi’s quickcheck (a port of Haskell QuickCheck) which is great for property-based testing, but doesn’t help with data-driven example-based testing.
Is anyone working on Rust support for data-driven (aka table-driven) example-based testing?