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
529 downloads per month
Used in 5 crates
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
- https://docs.rs/cargo-test-support:
targeted at external tool developers testing cargo-related code
- Released with every rustc release
- https://doc.rust-lang.org/nightly/nightly-rustc/cargo_test_support:
targeted at cargo contributors
- Updated on each update of the
cargo
submodule inrust-lang/rust
- Updated on each update of the
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