Open Manishearth opened 1 month ago
Actually, I think the best path forward is this:
tests/foo.rs
, and are compiled (but have no run behavior)tests/snapshots.rs
that iterates all other tests and insta-snapshots their codegenfeature_tests
and examples
get an additional gen pass that iterates each file and codegens it into macro_expanded/
or something. These files just exist and are not expected to compile (we don't hook them up to a Cargo.toml
or anything, since the feature_test crate compilation already tests this end-to-end)I think this would be particularly useful for other people hacking on Diplomat, and of course makes it easier to review macro changes. So far we basically haven't touched the macro much, but I've also found myself afraid of touching the macro because I don't want to subtly break FFI. having more checked in generated stuff would greatly help.
I think instead of having insta tests in lib.rs, the macro should test things by having files in
tests/
, which get run with the macro, and alsohave a
tests/insta_runner.rs` that runs the test files through the macro and generates insta snapshots.