Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Output satisfies predicate? #55

Closed
Closed
@dsprenkels

Description

@dsprenkels

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions