Function run

Source
pub fn run<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 run [ARGS].

ยงExamples

Simple:

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

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

Advanced:

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