| Crates.io | shoulds |
| lib.rs | shoulds |
| version | 0.3.0 |
| created_at | 2021-12-12 16:25:11.777722+00 |
| updated_at | 2025-07-13 15:50:19.717599+00 |
| description | An intuitive, fluent assertion library for writing expressive test expectations in Rust. |
| homepage | |
| repository | https://github.com/tarrball/shoulds |
| max_upload_size | |
| id | 496617 |
| size | 25,894 |
shoulds is a fluent assertion library for Rust tests, inspired by FluentAssertions and Shouldly.
It helps you write readable, intention-revealing tests like:
use shoulds::Shouldable;
#[test]
fn adds_numbers_correctly() {
let result = 40 + 2;
result.should().eq(&42);
}
The API is designed to be intuitive and discoverable, so you can express expectations naturally—with minimal boilerplate and maximum clarity.
Currently supported:
should().eq(&expected)should().ne(&unexpected)should().be_true()should().be_false()should().be_some()should().be_none()should().be_ok()should().be_err()In your Cargo.toml:
[dev-dependencies]
shoulds = "0.3.0"
use shoulds::Shouldable;
fn add(a: i32, b: i32) -> i32 {
a + b
}
#[test]
fn it_adds_numbers() {
let result = add(40, 2);
result.should().eq(&42);
}
MIT