Expand description
RsUnit is a unit testing framework for Rust. It’s a wrapper around the native cargo test interface.
RsUnit mimics the structure and behavior of ExUnit.
- Easy to use Import the macro and build organized unit tests with the
describeandtestblocks. - ** Simple testing setup** Create with
setup,setup_all,teardownandteardown_allfunctions that are run once or before every test and keep the rest of your tests organized in blocks.
§Example
use rs_unit::rs_unit;
fn add(a: i32, b: i32) -> i32 {
a + b
}
rs_unit! {
describe "Addition" {
test "success: Add positive numbers" {
let result = add(1,1);
assert_eq!(result, 2);
}
test "success: Add negative numbers" {
let result = add(-2, -2);
assert_eq!(result, -4);
}
}
}