#proc-macro-attributes #proc-macro

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

#494 in Testing

Download history 217370/week @ 2026-02-09 207005/week @ 2026-02-16 245262/week @ 2026-02-23 281509/week @ 2026-03-02 391486/week @ 2026-03-09 300411/week @ 2026-03-16 254632/week @ 2026-03-23 283543/week @ 2026-03-30 288965/week @ 2026-04-06 301659/week @ 2026-04-13 310668/week @ 2026-04-20 342841/week @ 2026-04-27 319335/week @ 2026-05-04 396725/week @ 2026-05-11 421094/week @ 2026-05-18 407581/week @ 2026-05-25

1,579,463 downloads per month
Used in 307 crates (5 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

~93–435KB
~10K SLoC