This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
turn dns_test::{subject,peer}
into immutable statics
#43
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.
using
std::env::set_var
to set or change the value of either DNS_TEST_SUBJECT or DNS_TEST_PEER is A Bad Idea, specially so when tests are running in parallelwe can't forbid the use of
env::set_var
but at least we can ensure that even in its presence the return value ofdns_test::{subject,peer}
will not changethis is accomplished using a "lazy" static variable that gets initialized at most once during the lifetime of the process instead of reading the env var each time
{subject,peer}
is calledto better convey the fact that the return value of
{subject,peer}
won't change, we present them as static variables instead