sweet

Write many tests quickly and cleanly.

Features

```rust pub use sweet::*;

sweet! { it "works" { // use regular assertions assert!(true == false); // or pretty matchers expect(true).tobefalse()?; expect("some string").not().tostartwith("some")?; } } ```

Native

The Sweet harness has a couple of advantages over default tests. - Suites - Organize your tests into collections - Matchers - Matchers specific to a type enables a harness to output more intuitive results instead of an opaque panic! - rs expect("foo").not().to_start_with("bar") //expected: NOT to start with 'bar' //received: 'foo' - Single Binary - The default intergration test approach creates a seperate binary for each test, which ramps up compile times, see this blog for more info.

Quickstart

  1. edit cargo.toml ```toml [dev-dependencies] sweet = # current version here

    [[test]] name = "sweet" path = "test/sweet.rs" harness = false ```

  2. create file test/sweet.rs ```rust

    ![feature(imported_main)]

    pub use sweet::*;

    sweet! { it "works" { expect(true).tobefalse()?; } } ```

  3. run cargo test --test sweet

Features - CLI

WASM

The wasm test harness has different priorities from wasm-bindgen-test - UI - Tests are run in a *mostly isolated iframe (see TODO) - Interactive - the runner will list all tests and they can be run at-will in the browser.

Quickstart

  1. Follow native quickstart
  2. install the cli
  3. forky_cli sweet

Features - Summary

Dont Panic

Or do, thats ok too. Currently you'll get the prettiest output by using the provided matchers that return results intstead of panicing, especially in wasm as panic=unwind isnt yet supported for wasm.

Reference

TODO