15 releases (8 stable)

1.0.8 Jan 15, 2021
1.0.7 Dec 11, 2020
1.0.6 Oct 29, 2020
1.0.4 Jul 10, 2020
0.1.6 Nov 3, 2019

#458 in Procedural macros

Download history 454/week @ 2021-01-03 382/week @ 2021-01-10 463/week @ 2021-01-17 658/week @ 2021-01-24 483/week @ 2021-01-31 483/week @ 2021-02-07 539/week @ 2021-02-14 459/week @ 2021-02-21 686/week @ 2021-02-28 389/week @ 2021-03-07 412/week @ 2021-03-14 554/week @ 2021-03-21 559/week @ 2021-03-28 768/week @ 2021-04-04 840/week @ 2021-04-11 500/week @ 2021-04-18

1,864 downloads per month
Used in less than 10 crates

MIT/Apache

40KB
933 lines

macrotest

Travis-CI Crates.io MSRV 1.34.0 docs.rs Crates.io Crates.io

Similar to trybuild, but allows you to test how declarative or procedural macros are expanded.

Minimal Supported Rust Version: 1.34.0


Documentation

Please refer to the documentation.

Example

Install nightly rust, cargo expand and rustfmt.

Add to your crate's Cargo.toml:

[dev-dependencies]
macrotest = "1"

Under your crate's tests/ directory, create tests.rs file containing the following code:

#[test]
pub fn pass() {
    macrotest::expand("tests/expand/*.rs");
}

Populate the tests/expand/ directory with rust source files. Each source file is a macro expansion test case.

See test-project and test-procmacro-project for the reference.

Dependencies

~1.4–2.1MB
~48K SLoC