22 releases (stable)

1.2.0 Jul 31, 2025
1.1.0 Feb 23, 2025
1.0.13 Jul 9, 2024
1.0.11 Mar 30, 2024
0.1.6 Nov 3, 2019

#8 in Procedural macros

Download history 10263/week @ 2025-10-25 15825/week @ 2025-11-01 17813/week @ 2025-11-08 14736/week @ 2025-11-15 9467/week @ 2025-11-22 9518/week @ 2025-11-29 9407/week @ 2025-12-06 8778/week @ 2025-12-13 10677/week @ 2025-12-20 10167/week @ 2025-12-27 15013/week @ 2026-01-03 7082/week @ 2026-01-10 7838/week @ 2026-01-17 11222/week @ 2026-01-24 11368/week @ 2026-01-31 10463/week @ 2026-02-07

41,832 downloads per month
Used in 84 crates

MIT/Apache

45KB
1K SLoC

macrotest

Github Actions Crates.io Crates.io (MSRV) docs.rs Crates.io (Downloads) Crates.io (License)

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

Minimal Supported Rust Version: 1.66


Documentation

Please refer to the documentation.

Example

Install 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.2–2.1MB
~46K SLoC