Crates.io | expect_rs |
lib.rs | expect_rs |
version | 0.0.2 |
source | src |
created_at | 2022-04-11 12:46:46.537865 |
updated_at | 2022-04-11 12:51:16.689841 |
description | This is the jest expect like matcher. |
homepage | https://github.com/ishibashi-futos/expect-rust |
repository | |
max_upload_size | |
id | 565687 |
size | 23,662 |
This is the jest expect
like matcher.
Function to use when you want to test a value. The test always starts here.
let a = some_function();
expect(&a).equals(&expected);
Evaluate equivalency
let a = some_function();
expect(&a).equals(&expected);
Expect the function call to terminate at Panic
let f = || {
panic!("err");
};
expect(&f).should_panic(); // Ok
let f = || {
// non panic
};
expect(&f).should_panic(); // Ng
Tests that one of the values can be obtained and that the expected value can be obtained.
let v = Some(100);
expect(&v).is_some_equal_to(&100);
Use the crates.io repository; add this to your Cargo.toml along with the rest of your dependencies:
[dependencies]
expect_rs = "*"
or
expect_rs = { git = "https://github.com/ishibashi-futos/expect-rust", branch = "main" }
MIT