1 unstable release
Uses old Rust 2015
0.0.1 | Nov 11, 2014 |
---|
#19 in #fluid
5KB
93 lines
Enforce
Fluid Assertions in Rust
Example
Uses stainless for testing syntax
describe! vec {
describe! push {
before_each {
let mut v = vec![1u, 2, 3];
}
it "should increase the length by 1" {
let old = v.len();
v.push(4u);
// Fluid chain with informative error messages.
(enforce!(old + 1)).is().equal(v.len());
}
it "should add another value to the end of the vec" {
v.push(4u);
// Has `some`, `none`, `ok`, and `err` methods for checking Option
// and Result APIs.
(enforce!(*v.get_mut(3))).is().some();
}
}
}
Failed Assertion
Enforce Error file.rs:17 - map.find("no such key") is None
License
MIT
lib.rs
:
Fluid assertions in Rust.