20 releases (13 stable)

1.0.13 Jul 9, 2024
1.0.11 Mar 30, 2024
1.0.9 Jun 20, 2022
1.0.8 Jan 15, 2021
0.1.6 Nov 3, 2019

#10 in Procedural macros

Download history 1893/week @ 2024-09-02 1184/week @ 2024-09-09 726/week @ 2024-09-16 892/week @ 2024-09-23 600/week @ 2024-09-30 683/week @ 2024-10-07 921/week @ 2024-10-14 805/week @ 2024-10-21 1340/week @ 2024-10-28 1211/week @ 2024-11-04 1235/week @ 2024-11-11 1271/week @ 2024-11-18 1335/week @ 2024-11-25 1246/week @ 2024-12-02 1472/week @ 2024-12-09 992/week @ 2024-12-16

5,202 downloads per month
Used in 48 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 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–2MB
~43K SLoC