Read files based on a glob pattern, and generate a separate test for each matching file:
Details
- One module is emitted for each nested directory, and each file in that directory becomes a test function:
inputs/a.txt->mod inputs { #[test] fn a() {} }inputs/nested/a.txt->mod inputs { mod nested { #[test] fn a() {} } }
- The proc macro doesn't use
synorquote, instead parsing fromproc_macro2tokens. - Globbing is powered by
glob.
This library was specifically developed with insta in mind:
Each file will produce one snapshot, just like insta::glob!. The primary difference is that now each snapshot
also gets its own unique test function, which means:
- All snapshot tests can run in parallel.
- Tests continue on error: A panic in one snapshot test doesn't cause all other tests in the same
glob!to stop.
It is recommended that you put a build.rs file in any crate which uses this library:
// build.rs
That ensures changes to test files are always reflected in the test binary.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.