18 releases (11 stable)

1.0.11 Mar 30, 2024
1.0.9 Jun 20, 2022
1.0.8 Jan 15, 2021
1.0.7 Dec 11, 2020
0.1.6 Nov 3, 2019

#12 in Procedural macros

Download history 498/week @ 2023-12-23 905/week @ 2023-12-30 714/week @ 2024-01-06 737/week @ 2024-01-13 606/week @ 2024-01-20 568/week @ 2024-01-27 647/week @ 2024-02-03 824/week @ 2024-02-10 786/week @ 2024-02-17 638/week @ 2024-02-24 987/week @ 2024-03-02 795/week @ 2024-03-09 1010/week @ 2024-03-16 1148/week @ 2024-03-23 2175/week @ 2024-03-30 1216/week @ 2024-04-06

5,635 downloads per month
Used in 27 crates

MIT/Apache

44KB
1K SLoC

macrotest

Travis-CI Crates.io MSRV 1.56 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.56


Documentation

Please refer to the documentation.

Example

Install nightly rust and cargo expand.

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.1–1.9MB
~42K SLoC