16 releases (9 stable)

1.0.9 Jun 20, 2022
1.0.8 Jan 15, 2021
1.0.7 Dec 11, 2020
1.0.6 Oct 29, 2020
0.1.6 Nov 3, 2019

#20 in Procedural macros

Download history 1204/week @ 2022-11-28 1064/week @ 2022-12-05 1174/week @ 2022-12-12 952/week @ 2022-12-19 918/week @ 2022-12-26 906/week @ 2023-01-02 1112/week @ 2023-01-09 914/week @ 2023-01-16 924/week @ 2023-01-23 853/week @ 2023-01-30 874/week @ 2023-02-06 844/week @ 2023-02-13 808/week @ 2023-02-20 850/week @ 2023-02-27 797/week @ 2023-03-06 734/week @ 2023-03-13

3,335 downloads per month
Used in 19 crates

MIT/Apache

41KB
966 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 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.4–2.1MB
~48K SLoC