specit
Spec "it" for Rust testing
Install
# Cargo.toml
[]
= "0.3.0"
Usage
use it;
The test output is like the following.
running 2 tests
test should_be_correct ... ok
test should_be_wrong ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
describe
use describe;
The test output with describe
is like the following.
running 2 tests
test arithmetic_operations::should_add_two_numbers ... ok
test arithmetic_operations::should_multiple_two_numbers ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
#[tokio::test] support
You can test with #[tokio::test]
for asynchronous functions.
use it;
async
You can get short your code using the following features in each asynchronous runtime.
features = ["tokio"]
You can use use specit::tokio_it as it
for testing asynchronous functions without #[tokio::test]
like the following.
use tokio_it as it;
async
features = ["async-std"]
Use #[it(...)]
instead of #[async_std::test]
as follows.
use async_std_it as it;
async
features = ["lib-wasm-bindgen"]
Use #[it(...)]
instead of #[wasm_bindgen_test::wasm_bindgen_test]
as follows.
use wasm_bindgen_test_it as it;
use JsValue;
use JsFuture;
async
Internal
Internally, the functions above are should_be_correct()
and should_be_wrong()
. You can use any string. Non-alphanum characters are encoded into '_'
.