Class Dune::XT::Common::Test::ScopedEnvVar¶
-
class Dune::XT::Common::Test::ScopedEnvVar¶
Sets an environment variable for the duration of a scope and restores it afterwards.
Restoration happens in the destructor rather than at the end of the test body, so it also runs when an ASSERT_* aborts the test early – a failing test should not leak its environment into the ones which run after it.
The main user is TERM: everything in dune-xt which decides whether to emit ANSI escape sequences goes through Dune::XT::Common::terminal_supports_color(), which inspects TERM. Tests which assert on such output have to pin TERM down, or they pass or fail depending on the terminal they happen to be run from.
Method Dune::XT::Common::Test::ScopedEnvVar::operator=¶
-
ScopedEnvVar &Dune::XT::Common::Test::ScopedEnvVar::operator=(const ScopedEnvVar&) = delete¶
No documentation provided.
Method Dune::XT::Common::Test::ScopedEnvVar::operator=¶
-
ScopedEnvVar &Dune::XT::Common::Test::ScopedEnvVar::operator=(ScopedEnvVar&&) = delete¶
No documentation provided.
Method Dune::XT::Common::Test::ScopedEnvVar::assign¶
-
void Dune::XT::Common::Test::ScopedEnvVar::assign(const char *value) const¶
No documentation provided.
Constructor Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar¶
-
Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar(std::string name, const char *value)¶
Pass nullptr as value to remove the variable from the environment for the duration of the scope.
Constructor Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar¶
-
Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar(const ScopedEnvVar&) = delete¶
No documentation provided.
Constructor Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar¶
-
Dune::XT::Common::Test::ScopedEnvVar::ScopedEnvVar(ScopedEnvVar&&) = delete¶
No documentation provided.
Destructor Dune::XT::Common::Test::ScopedEnvVar::~ScopedEnvVar¶
-
Dune::XT::Common::Test::ScopedEnvVar::~ScopedEnvVar()¶
No documentation provided.
Field Dune::XT::Common::Test::ScopedEnvVar::name_¶
-
const std::string Dune::XT::Common::Test::ScopedEnvVar::name_¶
No documentation provided.
Field Dune::XT::Common::Test::ScopedEnvVar::was_set_¶
-
bool Dune::XT::Common::Test::ScopedEnvVar::was_set_¶
No documentation provided.
Field Dune::XT::Common::Test::ScopedEnvVar::previous_¶
-
std::string Dune::XT::Common::Test::ScopedEnvVar::previous_¶
No documentation provided.