5 releases (3 breaking)

0.4.0 Oct 17, 2024
0.3.0 Sep 5, 2024
0.2.1 Jul 25, 2024
0.2.0 Jun 17, 2024
0.1.0 Mar 20, 2024

#603 in Development tools

Download history 156/week @ 2024-07-28 77/week @ 2024-08-04 74/week @ 2024-08-11 73/week @ 2024-08-18 69/week @ 2024-08-25 301/week @ 2024-09-01 121/week @ 2024-09-08 245/week @ 2024-09-15 202/week @ 2024-09-22 153/week @ 2024-09-29 167/week @ 2024-10-06 262/week @ 2024-10-13 100/week @ 2024-10-20 138/week @ 2024-10-27 149/week @ 2024-11-03 118/week @ 2024-11-10

525 downloads per month
Used in 5 crates

MIT/Apache

310KB
6.5K SLoC

WARNING: You might not want to use this outside of Cargo.

  • This is designed for testing Cargo itself. Use at your own risk.
  • No guarantee on any stability across versions.
  • No feature request would be accepted unless proved useful for testing Cargo.

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

WARNING: You might not want to use this outside of Cargo.

  • This is designed for testing Cargo itself. Use at your own risk.
  • No guarantee on any stability across versions.
  • No feature request would be accepted unless proved useful for testing Cargo.

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
~807K SLoC