https://github.com/jeremydavis519/runtime-macros
Simulate expansion of procedural macros at run time
https://github.com/jeremydavis519/runtime-macros
code-coverage macros proc-macro rust testing
Last synced: 7 months ago
JSON representation
Simulate expansion of procedural macros at run time
- Host: GitHub
- URL: https://github.com/jeremydavis519/runtime-macros
- Owner: jeremydavis519
- License: apache-2.0
- Created: 2018-04-30T07:50:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-25T03:51:13.000Z (over 1 year ago)
- Last Synced: 2024-10-10T15:18:08.394Z (over 1 year ago)
- Topics: code-coverage, macros, proc-macro, rust, testing
- Language: Rust
- Size: 83 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# runtime-macros
This crate offers a way to emulate the process of procedural macro expansion at run time.
It is intended for use with code coverage tools like [`cargo-tarpaulin`], which can't measure
the code coverage of anything that happens at compile time.
The `runtime-macros` crate works with `functionlike!`, `#[attributelike]`, and `#[derive(...)]`
procedural macros. There are no plans to support declarative macros.
[`cargo-tarpaulin`]: https://crates.io/crates/cargo-tarpaulin
To use `runtime-macros`, add a test case to your procedural macro crate that calls one of the
`emulate_*_macro_expansion` functions on a `.rs` file that calls the macro. Most likely, all the
files you'll want to use it on will be in your crate's `/tests` directory. Once you've completed
this step, any code coverage tool that works with your crate's test cases will be able to report on
how thoroughly you've tested the macro.
See the `/examples` directory in the [repository] for working examples.
[repository]: https://github.com/jeremydavis519/runtime-macros