8 releases (breaking)

0.7.0 Feb 20, 2025
0.6.0 Jan 9, 2025
0.5.0 Nov 28, 2024
0.4.0 Oct 17, 2024
0.1.0 Mar 20, 2024

#325 in Testing

Download history 182/week @ 2024-11-17 253/week @ 2024-11-24 120/week @ 2024-12-01 189/week @ 2024-12-08 117/week @ 2024-12-15 63/week @ 2024-12-22 89/week @ 2024-12-29 255/week @ 2025-01-05 137/week @ 2025-01-12 206/week @ 2025-01-19 147/week @ 2025-01-26 247/week @ 2025-02-02 127/week @ 2025-02-09 320/week @ 2025-02-16 185/week @ 2025-02-23 132/week @ 2025-03-02

784 downloads per month
Used in 6 crates

MIT/Apache

300KB
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

~31–45MB
~828K SLoC