6 releases (breaking)

0.5.0 Nov 28, 2024
0.4.0 Oct 17, 2024
0.3.0 Sep 5, 2024
0.2.1 Jul 25, 2024
0.1.0 Mar 20, 2024

#244 in Testing

Download history 72/week @ 2024-08-16 59/week @ 2024-08-23 203/week @ 2024-08-30 223/week @ 2024-09-06 230/week @ 2024-09-13 210/week @ 2024-09-20 158/week @ 2024-09-27 152/week @ 2024-10-04 216/week @ 2024-10-11 171/week @ 2024-10-18 90/week @ 2024-10-25 175/week @ 2024-11-01 85/week @ 2024-11-08 206/week @ 2024-11-15 210/week @ 2024-11-22 169/week @ 2024-11-29

689 downloads per month
Used in 5 crates

MIT/Apache

305KB
6.5K SLoC

This crate is maintained by the Cargo team, primarily for use by Cargo and not intended for external use. This crate may make major changes to its APIs or be deprecated without warning.


lib.rs:

Cargo test support.

See https://rust-lang.github.io/cargo/contrib/ for a guide on writing tests.

There are two places you can find API documentation

This crate is maintained by the Cargo team, primarily for use by Cargo and not intended for external use. This crate may make major changes to its APIs or be deprecated without warning.

Example

use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::project;

#[cargo_test]
fn some_test() {
    let p = project()
        .file("src/main.rs", r#"fn main() { println!("hi!"); }"#)
        .build();

    p.cargo("run --bin foo")
        .with_stderr_data(str![[r#"
[COMPILING] foo [..]
[FINISHED] [..]
[RUNNING] `target/debug/foo`
"#]])
        .with_stdout_data(str![["hi!"]])
        .run();
}

Dependencies

~30–44MB
~802K SLoC