Hamcrest
Installing
To use Hamcrest, add this to your Cargo.toml
:
[dev-dependencies]
hamcrest = "*"
And this to your crate root:
extern crate hamcrest;
After a quick cargo build
, you should be good to go!
Usage
Hamcrest supports a number of matchers. The easiest way is to just use
them all like this:
use *;
If you want to be more selective make sure that you also import the HamcrestMatcher
trait.
equal_to
assert_that!;
close_to
assert_that!;
assert_that!;
existing_{file,path,dir}
assert_that!;
assert_that!;
assert_that!;
none
assert_that!;
assert_that!;
contains and contains_exactly
assert_that!;
assert_that!;
assert_that!;
assert_that!;
matches_regex
assert_that!;
assert_that!;
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.