eupn/macrotest

Test harness for declarative and procedural macros expansion via `cargo-expand`

Rust

70

157 commits

updated Jul 20, 2026

See the code

README

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.76


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.

Contributors

eupn

102 commits

taiki-e

44 commits

ijackson

3 commits

dtolnay

3 commits

eupn/macrotest

Test harness for declarative and procedural macros expansion via `cargo-expand`

Rust

70

157 commits

updated Jul 20, 2026

See the code

README

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.76


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.

Contributors

eupn

102 commits

taiki-e

44 commits

ijackson

3 commits

dtolnay

3 commits

Languages

Rust

100.0%