This repository was archived by the owner on Dec 8, 2021. It is now read-only.
feat: add new support for testing with environment variables#180
Merged
devbww merged 3 commits intogoogleapis:masterfrom Feb 21, 2020
Merged
feat: add new support for testing with environment variables#180devbww merged 3 commits intogoogleapis:masterfrom
devbww merged 3 commits intogoogleapis:masterfrom
Conversation
`EnvironmentRestorer` is an RAII object that will, upon destruction,
restore the previous state of environment variables that it modified.
For example:
```
// ${VAR} has some initial state.
{
EnvironmentRestorer env;
env.SetEnv("VAR", "value");
// ${VAR} now holds "value".
}
// The initial state of ${VAR} has been restored.
```
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
+ Coverage 96.23% 96.27% +0.03%
==========================================
Files 97 99 +2
Lines 4411 4429 +18
==========================================
+ Hits 4245 4264 +19
+ Misses 166 165 -1
Continue to review full report at Codecov.
|
coryan
approved these changes
Feb 19, 2020
Contributor
coryan
left a comment
There was a problem hiding this comment.
Reviewed 6 of 6 files at r1.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @devjgm)
devjgm
approved these changes
Feb 19, 2020
coryan
approved these changes
Feb 20, 2020
Contributor
coryan
left a comment
There was a problem hiding this comment.
Reviewed 6 of 6 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @devbww)
devjgm
approved these changes
Feb 21, 2020
coryan
pushed a commit
to coryan/google-cloud-cpp
that referenced
this pull request
Apr 24, 2020
…pis/google-cloud-cpp-common#180) `ScopedEnvironment` is an RAII object that will, upon destruction, restore the previous state of the environment variable it modified. For example: ``` // ${VAR} has some initial state. { ScopedEnvironment env("VAR", "value"); // ${VAR} now holds "value". } // The initial state of ${VAR} has been restored. ```
coryan
pushed a commit
to coryan/google-cloud-cpp
that referenced
this pull request
Apr 24, 2020
…pis/google-cloud-cpp-common#180) `ScopedEnvironment` is an RAII object that will, upon destruction, restore the previous state of the environment variable it modified. For example: ``` // ${VAR} has some initial state. { ScopedEnvironment env("VAR", "value"); // ${VAR} now holds "value". } // The initial state of ${VAR} has been restored. ```
coryan
pushed a commit
to coryan/google-cloud-cpp
that referenced
this pull request
Apr 24, 2020
…pis/google-cloud-cpp-common#180) `ScopedEnvironment` is an RAII object that will, upon destruction, restore the previous state of the environment variable it modified. For example: ``` // ${VAR} has some initial state. { ScopedEnvironment env("VAR", "value"); // ${VAR} now holds "value". } // The initial state of ${VAR} has been restored. ```
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
EnvironmentRestoreris an RAII object that will, upon destruction,restore the previous state of environment variables that it modified.
For example:
[Note: The idea is for this to replace
EnvironmentVariableRestore.]This change is