PackageTrack
Sign in Get early access

test-case

Provides #[test_case(...)] procedural macro attribute for generating parametrized test cases easily

3.3.1 59M downloads/mo #1114 most downloaded on crates.io frondeus/test-case

What this package is like to depend on

Last release 3 years ago

no release in 18 months

Release timing varies

gaps range from 9 days to 6 months

Nearly every release is documented

notes for 23 of 24 stable releases

Nothing withdrawn

no release was ever pulled

7 years old

29 releases · first in 2019

0 releases in the last 12 months

see the full history below

Release timeline

29 releases · Sep 2019 to Nov 2023
2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 29
  1. 3.3.1 17 Nov 2023
    Release notes

    What's Changed

    • Avoid emitting unnecessary error messages by test cases & remove proc-macro2-diagnostics dependency by @dtolnay in #138

    New Contributors

    Full Changelog: v3.3.0...v3.3.1

    Open source →
    Release notes

    Fixes

    • Avoid emitting additional misleading error messages by proc-macro2-diagnostics (#138)
    Open source →
  2. 3.3.0 17 Nov 2023
    Release notes

    What's Changed

    • Fix test_matrix example that does not compile in README by @ollien in #133
    • Add the ability to have comments in matrix tests by @ollien in #132
    • Remove proc-macro-error dependency by @tamird in #136
    • .github: replace actions-rs with dtolnay/rust-toolchain, add caching by @tamird in #137

    New Contributors

    Full Changelog: v3.2.1...v3.3.0

    Open source →
    Release notes

    Features

    • Allow comments in test-matrix macro (#132)

    Improvements

    • Drop proc-macro-error dependency & improve error messages (#136)
    Open source →
  3. 3.2.1 17 Sep 2023
    Release notes
    • Update syn dependency
    • Ensure that test-case targets latest core and macros subcrates.

    Full Changelog: v3.2.0...v3.2.1

    Open source →
    Release notes

    Improvements

    • Update syn dependency to 2.0
    • Ensure that test-case selects correct version of it's core and macros subcrates
    Open source →
  4. 3.2.0 16 Sep 2023
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v3.1.0...v3.2.0

    Open source →
    Release notes

    Features

    • Add test_matrix macro: generates test cases from Cartesian product of possible test function argument values (#128)

    Improvements

    • Retain allow attributes on test functions (#127)
    Open source →
  5. 3.1.0 02 Apr 2023
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v3.0.0...v3.1.0

    Open source →
    Release notes

    Features

    • Copy attribute span to generated test functions so that IDEs recognize them properly as individual tests

    Improvements

    • Added LICENSE file to child crates
    Open source →
  6. 3.0.0 13 Feb 2023
    Release notes

    Overview

    This crate provides the #[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 the test_case attribute.
    Under the hood, all test cases that share the same body are grouped into a mod, giving clear and readable test results.

    Changes

    • Split out test-case-core crate, allowing easier reuse in external crates. By @evforde

    IMPORTANT

    Starting with the 3.0 release, we are changing test-case MSRV policy. We no longer can maintain our goal of only bumping MSRV with major SemVer releases partly due to how fast rust landscape changes and partly to how the rest of the rust ecosystem prefers instead not to keep MSRV breakage treated as SemVer breakage, making stricter policies hard to maintain with limited resources we have. The current goal is to support up to 3 of the latest stable releases.
    We hope that with this change, we'll be able to speed up test-case's maintenance processes and add more features in the coming months.

    Open source →
    Release notes

    [IMPORTANT] Starting with 3.0 release we are changing test-case MSRV policy to support only 3 latest stable releases.

    Improvements

    • Split out functional parts of test-case-macros crate into test-case-core for easy reuse by external libraries
    Open source →
  7. 2.2.2 01 Oct 2022
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v2.2.1...v2.2.2

    Open source →
    Release notes

    Fixes

    • Use fully qualified test macro path to avoid conflicts in workspace (#105)
    Open source →
  8. 2.2.1 21 Jul 2022
    Release notes

    Bugfix release - ensure test-case depends on correct version of test-case-macros
    Full Changelog: v2.2.0...v2.2.1

    Open source →
    Release notes

    Fixes

    • Ensure test-case depends on correct version of test-case-macros
    Open source →
  9. 2.2.0 21 Jul 2022
    Release notes

    What's Changed

    New Contributors

    • @ijc made their first contribution in #103

    Full Changelog: v2.1.0...v2.2.0

    Open source →
    Release notes

    Features

    • Support ignore["reason"] syntax (#102)
    Open source →
  10. 2.1.0 18 May 2022
    Release notes

    What's Changed

    Full Changelog: v2.0.2...v2.1.0

    Open source →
    Release notes

    Features

    • Support matches_regex complex test-case (requires with-regex feature) (#98)
    • Support len, count and empty complex test-cases (#97)

    Fixes

    • Support keyword ignore on void fn (#100)

    Improvements

    • Move macros to separate subcrate so that test-case can export other things (#96)
    Open source →
  11. 2.0.2 25 Mar 2022
    Release notes

    Fixes

    • Covered missing cases in matches X if Y test_case variant (fixes the fact that previous bug fix didn't produce guard code)
    Open source →
  12. 2.0.1 21 Mar 2022
    Release notes

    Fixes

    • matches Pattern if condition parses correctly (if condition part wasn't allowed)
    Open source →
  13. 2.0.0 22 Feb 2022
    Release notes

    Features

    • => with |x: T| assert!(x) custom inline test assertions
    • => using path::to::fn custom fn test assertions
    • ignore|inconclusive can be combined with other keywords (eg.: => ignore matches Ok(_))
    • => it|is ... syntax is a built-in (previously required hamcrest2 crate integration)
    • Tested items are left in place where they were defined #77
    • Simple test cases allow Result<(), _> return types similar to native #[test] macro

    Improvements

    • Significant code refactoring
    • Improved test case name selection

    Breaking changes

    • Deprecation of inconclusive within test description string - it will no longer act like modifier keyword
    • Deprecation of hamcrest2 integration
    • Deprecation of allow_result feature
    Open source →
  14. 2.0.0-rc3 13 Feb 2022 pre-release

    Nothing published for this version

  15. 2.0.0-rc2 27 Jan 2022 pre-release

    Nothing published for this version

  16. 2.0.0-rc1 19 Dec 2021 pre-release

    Nothing published for this version

  17. 1.2.3 08 Feb 2022
    Release notes

    Fixes

    • Fix regression where panics and inconclusive were not allowed on test_cases returning a value
    • Fix case where test_case would allow to return a type when only single attribute was used
    Open source →
  18. 1.2.2 06 Feb 2022
    Release notes

    Fixes

    • test-case no longer allows returning values from tested function without => pattern (thanks to @tarka)
      • Behaviour can be reenabled via allow_result feature
    Open source →
  19. 1.2.1 28 Oct 2021
    Release notes

    Fixes

    • Disabled clippy warning when test-case was generating assert_eq(bool, bool) expression.
    Open source →
  20. 1.2.0 27 Jun 2021
    Release notes

    Features

    • Allow usage of fully qualified attribute #[test_case::test_case] (thanks to @tomprince)

    Improvements

    • Stopped code from emmiting unneded () expression in test cases with expected fragment (thanks to @martinvonz)
    Open source →
  21. 1.1.0 10 Jan 2021
    Release notes

    Features

    • Added support for using hamcrest2 assertions with test case
    • Enabled support of async via tokio or similar
    • Enabled attribute passthrough for test cases - it means that you can combine test-case with other testing frameworks, given at least one #[test_case] attribute appears before mentioned framework in testing function

    Deprecation

    • inconclusive inside test case name will not be supported starting 2.0.0
    Open source →
  22. 1.0.1 12 Jan 2021

    Nothing published for this version

  23. 1.0.0 28 Jan 2020
    Release notes

    Features

    • Added support for three new keywords: panics, matches and inconclusive 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")]
      

      inconclusive ignores one specific test case.- thanks to @luke_biel

      #[test_case("42")]
      #[test_case("XX" ; "inconclusive - parsing letters temporarily doesn't work, but it's ok")]
      #[test_case("na" => inconclusive ())]
      

    Major improvements

    • Added extra unit tests - thanks to @luke-biel
    • Replace parented_test_case with parsing test_case directly from args - thanks to @luke-biel
    • Added keeping trailing underscores in names - thanks to @rzumer

    Minor improvements

    • Moved lazy-static dependency to dev-dependencies
    • Fixed README - thanks to @luke-biel and @drwilco

    Upgraded dependencies

    • Upgraded insta to 0.12.0
    Open source →
  24. 1.0.0-alpha-1 05 Nov 2019 pre-release

    Nothing published for this version

  25. 0.3.3 01 Oct 2019
    Release notes

    Fixes

    • Fixed "inconclusive" feature with different cases.
    Open source →
  26. 0.3.3-alpha1 01 Oct 2019 pre-release

    Nothing published for this version

  27. 0.3.2 01 Oct 2019
    Release notes

    Fixes

    • Added support for impl Trait - it worked in v2.x crate.

    Minor improvements

    • Added extra test cases

    Upgraded dependencies

    • Upgraded version_check to v0.9.1
    Open source →
  28. 0.3.1 27 Sep 2019
    Release notes

    Minor improvements:

    • Refreshed readme
    • Added CI for stable version of Rust. - thanks to @macisamuele
    • Limited crate to Rust 1.29+ - thanks to @macisamuele

    Upgraded dependencies:

    • Upgraded syn, quote and proc-macro-2 to v1
    • Upgraded lazy-static to 1.4.0
    • Upgraded insta to 0.11.0
    Open source →
  29. 0.3.0 27 Sep 2019
    Release notes

    Breaking changes

    • Crate has new maintainer: Wojciech Polak :hand: :tada:

    • Crate has new name, as test-case-derive had no meaning for derive part.

    • Delimiter for test case description is ; instead of ::.

      Reason: :: is valid part of expression and rustc treats const variable as path

    New features

    • Proper error propagation :tada: When there is for example a typo in function body, rustc can now show location of it instead of test_case location.
    • Internally for tests crate uses cargo insta for snapshot testing
    • Attribute is now compatible all other attributes like #[should_panic]
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive