tryexpand 0.0.0

Test harness for macro expansion
Documentation
tryexpand-0.0.0 has been yanked.

tryexpand

Crates.io Crates.io Crates.io docs.rs

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


Documentation

Please refer to the documentation on docs.rs.

Usage

Install Rust and cargo expand.

Add to your crate's Cargo.toml:

[dev-dependencies]
tryexpand = "0.1.0"

Under your crate's tests/ directory, create tests.rs file containing the following code:

#[test]
pub fn pass() {
    tryexpand::expand(["tests/expand_pass/*.rs"]);
    // or:
    tryexpand::expand_args(["tests/expand_pass/*.rs"], ["--features", "test-feature"]);
}

#[test]
pub fn fail() {
    tryexpand::expand_fail(["tests/expand_fail/*.rs"]);
    // or:
    tryexpand::expand_args_fail(["tests/expand_fail/*.rs"], ["--features", "test-feature"]);
}

Populate the tests/expand_pass//tests/expand_fail/ directories with Rust source files. Each source file is a macro expansion test case.

See tests/macro-tests and tests/proc-macro-tests for the reference.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT or Apache-2.0 – see the LICENSE-MIT.md/LICENSE-APACHE.md files for details.

Provenance

The tryexpand crate originated as a fork of eupn's macrotest (crates.io).