expectest 0.1.5

Library provides functions for unit testing with human-readable syntax. (WIP)
Documentation

expectest

Work In Progress

Library provides functions for unit testing with human-readable syntax. Inspired by Nimble for Swift.

One of main purposes of this library is to show what data was used in a broken test. Consider this example:

let result = ...;
expect!(result).to(be_equal_to([1, 2, 3]));

Assume that 'result' contains vec: [1, 2, 2]. Of course test fails and gives us a message:

expected to be equal to <[1, 2, 3]>, got <[1, 2, 2]>

Note: You need to use cargo test -- --nocapture to see output from tests.

Usage

In Cargo.toml:

[dev-dependencies]
expectest = "*"

In your crate:

#[cfg(test)]
#[macro_use(expect)]
extern crate expectest;

You can export all needed functions and types from prelude module:

use expectest::prelude::*;

Simple unit test:

expect!(Some(6)).to(be_some());

License

MIT