This repository was archived by the owner on Dec 29, 2021. It is now read-only.
Output satisfies predicate? #55
Closed
Description
Thanks for this awesome library!
I would like to check if the command's output is from a specific format. I am specifically dealing with formats like this:
0156dc3c96b0939fa...
02fab783bdfc017dd...
with the first byte being a counted integer, and the rest random. So I would like to check if the binary lengths are correct and if the first byte is 01, 02, ...
.
Is it possible to pass a function to a OutputAssertionBuilder
method which allows me to check by predicate?
If not, I would like to propose one (OutputAssertionBuilder::satisfy
), which you can call with a function which checks if the string satisfies a given predicate.
Example type signature:
fn satisfies<F>(pred: F) -> Assert
where F : FnOnce(&str) -> bool