Skip to content

Easy "stdout contains" assertions #11

Closed
@killercup

Description

@killercup

I'm trying to use this for a project instead of the published version of assert_cli. I'm super impressed by what you've accomplished here in the short time!

It seems that currently, there is no easy way to check that the output of a command contains some text. Or did I miss something?

Predicates only has a str::contains but stdout is a Vec<u8>. It seems that it could work with predicate::function, but it is quite cumbersome. I'm basically looking for good way of writing .stdout(&predicate::function(|x: &Vec<u8>| String::from_utf8_lossy(x).contains("Done!"))) -- but ideally without the need to use from_utf8_lossy. This last requirement is also why I opened this issue here, and not on the predicates, I expect we may need to talk about how to best deal with the Vec<u8> representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions