expect_rs 0.0.2

This is the jest expect like matcher.
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 24.52 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ishibashi-futos

expect-rust

This is the jest expect like matcher.

example

expect

Function to use when you want to test a value. The test always starts here.

let a = some_function();
expect(&a).equals(&expected);

equals

Evaluate equivalency

let a = some_function();
expect(&a).equals(&expected);

should panic

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

is some and equals

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);

Usage

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" }

LICENSE

MIT