Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved testing using a new glob macro #95

Merged
merged 2 commits into from
Sep 25, 2024
Merged

Conversation

jaybosamiya-ms
Copy link
Collaborator

This PR sets up a new glob attribute macro, intended to be used in tests. This helps split each of the larger snapshot tests up into smaller functions, allowing for parallelism between the snapshotted files when running cargo nextest run or cargo test.

There wasn't an existing crate that I could use that had glob at macro level, and to introduce a new proc macro, we need to set up a separate crate; this is set up as a crate within the same workspace. In the future, if I find this useful for other use cases too, I might split it off as a separate crate entirely, but for now, it can sit in this workspace.

It is easiest to see the impact of this change by looking at the output of cargo nextest run (or ~equivalently, cargo test). Before this PR, the entirety of verus-snapshot/**/*.rs ran within a single test function, but after this, each file gets its own function.

@jaybosamiya-ms
Copy link
Collaborator Author

One minor concern is that I don't know how the release process will be affected. I don't actually expect the release process to be affected, since this is added only as a dev-dependency, but if it is impacted, then I might need to spin off the crate sooner instead.

@jaybosamiya-ms jaybosamiya-ms merged commit 26aa968 into main Sep 25, 2024
8 checks passed
@jaybosamiya-ms jaybosamiya-ms deleted the jb-glob-macro branch September 25, 2024 00:05
jaybosamiya-ms added a commit that referenced this pull request Sep 25, 2024
This PR builds on #95, separating out the various snapshot tests that
were previously merged via
[`inline-crate`](https://crates.io/crates/inline-crate).
@jaybosamiya-ms
Copy link
Collaborator Author

The release, after introducing this as a dev-dependency worked perfectly fine. I was mostly concerned about the push to crates.io; the pre-builts had no reason to be affected, but I didn't know if the crates.io release would work out of the box---it did! https://crates.io/crates/verusfmt/0.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants