The equivalent of Jest for Rust.
Jrest is a testing framework project for Rust, inspired by Jest, easy to write and easy to read, with fancy diffs when tests fail.
⚠️ Be aware that this is a work in progress.
But it should get regular updates since I'm using it every week on my own open-source projects.
sh
cargo add --dev jrest
.to_be()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!("A &str").tobe("A &str"); expect!("A String".tostring()).tobe("A String".to_string()); } } ```
.to_be_greater_than()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!(3).tobegreaterthan(2); } } ```
.to_be_greater_than_or_equal()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!(3).tobegreaterthanorequal(2); expect!(3).tobegreaterthanor_equal(3); } } ```
.to_be_less_than()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!(2).tobelessthan(3); } } ```
.to_be_less_than_or_equal()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!(2).tobelessthanorequal(3); expect!(2).tobelessthanor_equal(2); } } ```
.to_start_with()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!("cargo").toend_with("go"); } } ```
.to_start_with()
```rust
mod tests { use jrest::expect;
#[test] fn testsomething() { expect!("cargo").tostart_with("car"); } } ```
.toContain()
.toHaveLength()
.toMatch()
.toMatchObject()
.toThrow()