#proc-macro #interpolation

macro interpolate_name

Simple procedural macro attribute for repetitive tests

8 releases

0.2.4 Sep 12, 2023
0.2.3 Aug 25, 2019
0.2.2 May 10, 2019
0.2.1 Mar 3, 2019
0.1.1 Aug 10, 2018

#737 in Testing

Download history 39462/week @ 2024-12-14 20989/week @ 2024-12-21 22145/week @ 2024-12-28 39392/week @ 2025-01-04 63155/week @ 2025-01-11 39746/week @ 2025-01-18 48829/week @ 2025-01-25 45884/week @ 2025-02-01 53815/week @ 2025-02-08 52060/week @ 2025-02-15 58647/week @ 2025-02-22 59090/week @ 2025-03-01 55481/week @ 2025-03-08 58548/week @ 2025-03-15 66654/week @ 2025-03-22 54506/week @ 2025-03-29

247,089 downloads per month
Used in 97 crates (4 directly)

MIT license

8KB
134 lines

interpolate_name

interpolate_name consists in a set of procedural macro attributes geared towards reduce the boilerplate while writing repetitive tests.

  • interpolate_test: a quick way to test the same function by passing specific arguments and have a test entry for each of them.
  • interpolate_name: a simple function renamer that can be combined with macros to support more complex patterns.

Procedural macro attribute to do not repeat yourself while testing

Usage

#[macro_use]
extern crate interpolate_name;

use interpolate_name::interpolate_test;

#[interpolate_test(foo, "foo")]
#[interpolate_test(bar, "bar")]
#[interpolate_test(baz, "baz")]
fn testme(f: &str) {
    println!("testing {}", f);
}

Produces

running 3 tests
test testme_baz ... ok
test testme_bar ... ok
test testme_foo ... ok

Dependencies

~195–620KB
~15K SLoC