Skip to content

Test-Case v1.0.0-alpha-1

Pre-release
Pre-release
Compare
Choose a tag to compare
@frondeus frondeus released this 05 Nov 15:47
· 116 commits to master since this release

Overview

This crate provides #[test_case] procedural macro attribute that generates multiple parametrized tests using one body with different input parameters.
A test is generated for each data set passed in test_case attribute.
Under the hood, all test cases that share same body are grouped into mod, giving clear and readable test results.

New features

  • Add support for two new keywords: panics and matches which can be applied after => token.

    matches gives possibility to test patterns, like:

    #[test_case("foo" => matches Some(("foo", _)))]

    panics gives should_panic(expected="...") for one test_case:

    #[test_case(true  => panics "Panic error message" ; "This should panic")]
    #[test_case(false => None                         ; "But this should return None")]

Major improvements

  • Add extra unit tests - thanks to @luke-biel
  • Replace parented_test_case with parsing test_case directly from args - thanks to @luke-biel

Minor improvements

  • Moved lazy-static dependency to dev-dependencies

Upgraded dependencies

  • Upgraded insta to 0.12.0