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

macro dev generic-tests

Procedural macro to define tests and benchmarks generically

5 releases

new 0.1.3 Nov 8, 2024
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

#143 in Testing

Download history 3547/week @ 2024-07-21 3366/week @ 2024-07-28 2463/week @ 2024-08-04 2993/week @ 2024-08-11 1918/week @ 2024-08-18 2283/week @ 2024-08-25 2786/week @ 2024-09-01 2948/week @ 2024-09-08 2642/week @ 2024-09-15 3899/week @ 2024-09-22 4022/week @ 2024-09-29 4524/week @ 2024-10-06 4172/week @ 2024-10-13 2682/week @ 2024-10-20 1828/week @ 2024-10-27 2300/week @ 2024-11-03

11,104 downloads per month
Used in 26 crates (25 directly)

MIT/Apache

44KB
966 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

~255–710KB
~17K SLoC