7 releases (breaking)

new 0.6.0 Jan 9, 2025
0.5.0 Nov 28, 2024
0.4.0 Oct 17, 2024
0.3.0 Sep 5, 2024
0.1.0 Mar 20, 2024

#317 in Testing

Download history 190/week @ 2024-09-23 127/week @ 2024-09-30 168/week @ 2024-10-07 270/week @ 2024-10-14 96/week @ 2024-10-21 134/week @ 2024-10-28 147/week @ 2024-11-04 125/week @ 2024-11-11 185/week @ 2024-11-18 287/week @ 2024-11-25 74/week @ 2024-12-02 204/week @ 2024-12-09 107/week @ 2024-12-16 59/week @ 2024-12-23 96/week @ 2024-12-30 248/week @ 2025-01-06

529 downloads per month
Used in 5 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–44MB
~813K SLoC