[reconfigurator] improvements to blueprint displays and tests#5248
Merged
sunshowers merged 2 commits intoMar 13, 2024
Merged
Conversation
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
davepacheco
approved these changes
Mar 13, 2024
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.
Bundles up a few changes:
Moves
fmt::DebugforBlueprintto adisplaymethod.fmt::Debugoutput should ideally look close enough to standardfmt::Debugoutput, so moving this to some kind offmt::Displayis good.But why move this to its own struct? Two reasons:
fmt::Displayimpl. Usingdisplaymakes this explicit.By the same logic as above, moves diff display to its own struct as well.
Adds snapshot tests to ensure that changes to display output aren't surprising.
To achieve this, adds determinism to each test by using a tree of RNGs. Initially these RNGs are seeded from entropy, but we can also choose to seed them from any fixed hashable value.
This tree of RNG approach is pretty standard in things like roguelikes, where I first came across it. It works quite well.