Catchr 
Experimental: Might eat your laundry!
A testing framework for Rust inspired by Catch for C++.
Quickstart
Add catchr = "0.2.1" to your Cargo.toml
Write tests:
cargo test
running 2 tests
test tests::section_my_tests::given_x_is_equal_to_1::when_2_is_added_to_x::then_x_should_equal_3 ... ok
test tests::section_my_tests::given_x_is_equal_to_1::when_1_is_added_to_x::then_x_should_equal_2 ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Sections
Each test section consists of a keyword, a description and a body.
keyword "description"
For the moment the following keywords are supported: section, case, when, then, given.
Sections without any nested section will become test cases. Sections function like scopes - that is statements from the outer section are available in the inner section:
when "something"
The let x = 1; can be used in the then "anything" section. But let y = 1; from the then "anything" section, cannot be used in the then "whatever" section.
Furthermore the scoping rules are preserved, so that inner test cases can borrow mutably without violating the borrow checker rules.
Consider the following example:
case "a"
if the test case was expanded without scoping, we'd get
let mut tmp = tempfile.unwrap;
let mut writer = new;
writer.write_all.unwrap;
tmp.seek.unwrap;
let bytes_in_tmp_file = tmp.seek.unwrap;
assert_eq!;
which fails to compile!
so catchr will expand this test case into
let mut tmp = tempfile.unwrap;
tmp.seek.unwrap;
let bytes_in_tmp_file = tmp.seek.unwrap;
assert_eq!;
How does it work?
The code from the Quickstart section will expand into something like this: