Function check

Source
pub fn check<I, P>(patterns: I) -> BuildTestSuite
where I: IntoIterator<Item = P>, P: AsRef<Path>,
Expand description

Run snapshot tests on files that match the provided paths/glob patterns, snapshotting the stdout/stderr output as it is produced by cargo check [ARGS].

ยงExamples

Simple:

#[test]
pub fn pass() {
    tryexpand::check(
        ["tests/expand/pass/*.rs"]
    ).expect_pass();
}

#[test]
pub fn fail() {
    tryexpand::check(
        ["tests/expand/fail/*.rs"]
    ).expect_fail();
}

Advanced:

#[test]
pub fn pass() {
    tryexpand::check(
        [
            "tests/expand/foo/pass/*.rs",
            "tests/expand/bar/pass/*.rs"
        ]
    )
    .args(["--features", "test-feature"])
    .envs([("MY_ENV", "my env var value")])
    .expect_pass();
}