#parametric #generics #proc-macro #test-cases #test-framework

macro dev generic-tests

Procedural macro to define tests and benchmarks generically

4 releases

0.1.2 Feb 6, 2021
0.1.1 Jul 7, 2020
0.1.0 Jun 25, 2020
0.1.0-beta.1 Jun 24, 2020

#366 in Testing

Download history 750/week @ 2023-11-28 1317/week @ 2023-12-05 1101/week @ 2023-12-12 3236/week @ 2023-12-19 1946/week @ 2023-12-26 2698/week @ 2024-01-02 996/week @ 2024-01-09 1634/week @ 2024-01-16 811/week @ 2024-01-23 2176/week @ 2024-01-30 1936/week @ 2024-02-06 1385/week @ 2024-02-13 1279/week @ 2024-02-20 2833/week @ 2024-02-27 1903/week @ 2024-03-05 2802/week @ 2024-03-12

9,073 downloads per month
Used in 17 crates

MIT/Apache

43KB
955 lines

Procedural macro support for generic test definitions

The procedural attribute macro provided by this crate allows the test writer to reuse code between test cases or benchmarks that use the same test protocol with different types under test. As in general programming with Rust, this is achieved by using generic parameters and trait bounds. The specific test cases are expanded in multiple submodules with type arguments provided in another attribute.

Features

  • Instantiates tests and benchmarks for the built-in test framework.
  • Supports arbitrary test function attributes provided by other crates.
  • A customizable set of attributes is copied from the generic test function to its instantiations.
  • Supports async tests.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~34K SLoC