| Crates.io | testx |
| lib.rs | testx |
| version | 0.1.2 |
| created_at | 2022-12-20 13:55:30.250456+00 |
| updated_at | 2022-12-22 13:08:49.011223+00 |
| description | An extended Rust testcase |
| homepage | |
| repository | https://github.com/drobin/testx-rs.git |
| max_upload_size | |
| id | 742349 |
| size | 18,717 |
The testx crate provides the testx macro, which is an extended version
of the Rust test macro. The key features are:
testx macro is fully compatible for the Rust test macro, all
tests maked with #[testx] (instead of #[test]) are executed with
cargo-test.testx testcaseMark the testcase with #[testx]. Calling cargo test will execute the
testcase.
use testx::testx;
#[testx]
fn sample() {
assert_eq!(1, 1);
}
// output:
// running 1 test
// test sample ... ok
setup functionProvide a function setup which prepares and returns some data for your
testcase. Next, your testcase needs one argument, which must match the
return value of the setup function.
A testcase marked with #[testx] will first execute the setup function
and will pass its return value to your testcase.
use testx::testx;
fn setup() -> u32 {
4711
}
#[testx]
pub fn sample(num: u32) {
assert_eq!(num, 4711);
}
Put the following line into the [dev-dependencies] section of your Cargo.toml:
[dev-dependencies]
testx = "0.1.2"