shoulds
shoulds is a fluent assertion library for Rust tests, inspired by FluentAssertions and Shouldly.
It helps you write readable, intention-revealing tests like:
use Shouldable;
let result = 42;
result.should.eq;
โจ Assertions
Currently supported:
โ Equality
should().eq(&expected)should().ne(&unexpected)
More comparison methods (greater than, less than, etc.) are coming soon.
๐ฆ Installation
In your Cargo.toml:
[]
= "0.2.0"
๐งช Example
use Shouldable;
๐ง Roadmap
Planned enhancements include:
- String and collection assertions (
contain,have_length, etc.) - Result/Option assertions (
be_ok,be_some) - Custom diffing for better failure output
- Optional colored output
- Snapshot support?
Want to help shape this crate? Feedback and contributions welcome!
โ ๏ธ Note
shoulds is still experimental and evolving. Expect breaking changes in the 0.x versions.
๐ License
MIT