Add lookup function to AtomTestContext #81
Merged
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.
Pull Request Type
Description
Add a new testing function
lookupto AtomTestContext such that testing code can access already cached value without any side effects.It is convenient when you want to print current the state without starting a side-effect-full process initiated by
readorwatch.Motivation and Context
readwas supposed to be enough for dumping the current state of an atom but it actually initiates a side-effect-full process for a moment while it will be terminated immediately.So, this PR is to add a useful, side-effect-free function for applications such as adding a print to debug the current state without changing the testing result.
Impact on Existing Code
AtomTestContext.wait(for:timeout:until:)started using the newlookupinstead ofreadto check the current state to determine that the state is matched with the expected condition.This is a change to eliminate a side effect that was unnecessary while waiting for a state change in that method, and there are no counterintuitive negative effects from it.