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

fix(snap): Provide more stable snapshots #266

Merged
merged 2 commits into from
Mar 1, 2024
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Mar 1, 2024

Before our auto-named snapshots used line numbers to make them unique.
This would fail within macros.
They could easily change for no good reason, requiring deleting the
entire snapshot directory and restarting.

In short, we change

  • from src/<mod>/snapshots/<file>-<line>.txt
  • to tests/snapshots/<normalized_fn_path>.txt where <normalized_fn_path> = <fn_path>.replace("::", "__")

Our paths were relative to the test file.
I reconsidered this when doing the above because the function name made
things less unique.
In making them unique, I'd need to extend the path a lot
(src/<path>/snapshots/<path>.txt).
So I moved them to the root to all be together.

Not considering this a breaking change because of how non-deterministic the file names were before.

epage added 2 commits March 1, 2024 12:56
Before our auto-named snapshots used line numbers to make them unique.
This would fail within macros.
They could easily change for no good reason, requiring deleting the
entire snapshot directory and restarting.

Our paths were relative to the test file.
I reconsidered this when doing the above because the function name made
things less unique.
In making them unique, I'd need to extend the path a lot
(`src/<path>/snapshots/<path>.txt`).
So I moved them to the root to all be together.
@epage epage merged commit e79db96 into assert-rs:main Mar 1, 2024
13 checks passed
@epage epage deleted the auto branch March 1, 2024 19:41
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.

1 participant