ratcc

Crates.ioratcc
lib.rsratcc
version0.1.3
sourcesrc
created_at2018-01-16 18:08:23.177009
updated_at2018-01-16 18:34:10.202876
descriptionRust Automated Test Cases in a Crate. A testing framework inspired by the Catch C++ framework. Requires nightly rust.
homepage
repositoryhttps://github.com/fitzgen/state_machine_future
max_upload_size
id47068
size8,671
Mikko Rantanen (Rantanen)

documentation

README

Ratcc

Rust Automated Test Cases in a Crate

Crates.io

A test frameworked for Rust, inspired by the Catch C++ test framework.

Usage

[dev-dependencies]
ratcc = "0.1"
#![feature(proc_macro)]
extern crate ratcc;
use ratcc::*;

#[catch_test]
fn example() {

    let a = 0;
    assert_eq!(a, 0);

    #[section("first succeeds")] {
        let b = 0;
        assert_eq!(a, b);

        #[section("second fails")] { assert!(false); }
    }

    #[section("first fails")] {
        let b = 1;
        assert_eq!(a, b);

        #[section("second succeeds")] {
            // The parent section fails assert so this never
            // gets executed.
            //
            // Should result in undefined result but doesn't.
            assert!(true);
        }
    }
}

// OUTPUT:
//
//   Running target/debug/deps/test-d4d1fd68ce8fee8b
//
//   running 5 tests
//   test example ... ok
//   test example_first_fails ... FAILED
//   test example_first_fails_second_succeeds ... FAILED
//   test example_first_succeeds ... ok
//   test example_first_succeeds_second_fails ... FAILED
Commit count: 86

cargo fmt