transpile: switch insta::glob!s to separate tests#1642
Merged
Conversation
f86aec4 to
d1ae9eb
Compare
Instead of using `insta::glob!`, we have explicit `#[test] fn`s for each test. This is what we do for `c2rust-refactor/tests/snapshots.rs`, too. Now we can easily run an individual test, run all of the tests in parallel much faster, and not stop at the first error if one fails. The `*-specific` directories are kept, although we don't need them anymore. We also delete the `dummy` files, as there's no more issue with `insta::glob!` using a different prefix when there's only one matching file in a directory.
d1ae9eb to
02b9ca2
Compare
fw-immunant
reviewed
Mar 6, 2026
fw-immunant
approved these changes
Mar 6, 2026
Since there's only a single `c_decls_snapshots`, I didn't add any extra code like `TranspileTest` for the transpile snapshots. Also, previously, the code wasn't accounting for needing a `dummy` and used the absolute path in the debug expression, which changes. Now both are fixed and a relative path is used.
02b9ca2 to
b3ab33d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces
insta::glob!usage inc2rust-transpile/tests/snapshots.rswith separate, dedicated#[test] fns.This is what we do for
c2rust-refactor/tests/snapshots.rs, too. Now we can easily run an individual test, run all of the tests in parallel much faster, and not stop at the first error if one fails. This is really useful as I upgrade to edition 2024 (PR soon).The
*-specificdirectories are kept, although we don't need them anymore. We also delete thedummyfiles, as there's no more issue withinsta::glob!using a different prefix when there's only one matching file in a directory.Also, the
c_decls_snapshotswere using absolute paths in their debug expressions, so the snapshot would be different on different machines. As I switched to#[test] fns, this uses relative paths by default and thus is automatically fixed as well.