Refactor to undo the removal of the real Env from Spec.#26
Merged
Conversation
Prior to #17, `Spec.env` would return a real instance of the `Env`, which the spec examples could use in any way (for example, using it as the root of authority to create a capability object such as with `TCP.auth`). But #17 removed this in favor of a `Spec.Env` abstraction that wraps a possible `Env`, but may not hold a real one. This was done for the purpose of making it possible to test the effects of `Spec.Process.run` in `Spec.Process.Spec`, so that we could have tests in the `Spec` package that test itself. However, it was not actually necessary to remove the real `Env` from `Spec.env` to accomplish this - we can still pass the user code the real `Env`, but use a capturing abstraction for spec effects (i.e. exit code and printed output). This PR renames `Spec.Env` as `_Effects`, and brings back the real `Env` as being present at `Spec.env`, while the internal mechanisms that set the exit code and print results will use `_Effects` instead, such that these effects can still be captured and tested in our self-test. See discussion in Zulip at: https://savi.zulipchat.com/#narrow/stream/294906-libraries/topic/Spec/near/301273284
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.
Prior to #17,
Spec.envwould return a real instance of theEnv, which the spec examples could use in any way (for example, using it as the root of authority to create a capability object such as withTCP.auth). But #17 removed this in favor of aSpec.Envabstraction that wraps a possibleEnv, but may not hold a real one.This was done for the purpose of making it possible to test the effects of
Spec.Process.runinSpec.Process.Spec, so that we could have tests in theSpecpackage that test itself.However, it was not actually necessary to remove the real
EnvfromSpec.envto accomplish this - we can still pass the user code the realEnv, but use a capturing abstraction for spec effects (i.e. exit code and printed output).This PR renames
Spec.Envas_Effects, and brings back the realEnvas being present atSpec.env, while the internal mechanisms that set the exit code and print results will use_Effectsinstead, such that these effects can still be captured and tested in our self-test.See discussion in Zulip at:
https://savi.zulipchat.com/#narrow/stream/294906-libraries/topic/Spec/near/301273284