An Environment object is capable of setting up and tearing down an environment. You should subclass this to define your own environment(s). An Environment object does the set-up and tear-down in virtual methods SetUp() and TearDown() instead of the constructor and the destructor, as: 1. You cannot safely throw from a destructor. This is a problem as in some cases Google Test is used where exce
| 13483 | // 2. You cannot use ASSERT_* directly in a constructor or |
| 13484 | // destructor. |
| 13485 | class Environment { |
| 13486 | public: |
| 13487 | // The d'tor is virtual as we need to subclass Environment. |
| 13488 | virtual ~Environment() {} |
| 13489 | |
| 13490 | // Override this to define how to set up the environment. |
| 13491 | virtual void SetUp() {} |
| 13492 | |
| 13493 | // Override this to define how to tear down the environment. |
| 13494 | virtual void TearDown() {} |
| 13495 | private: |
| 13496 | // If you see an error about overriding the following function or |
| 13497 | // about it being private, you have mis-spelled SetUp() as Setup(). |
| 13498 | struct Setup_should_be_spelled_SetUp {}; |
| 13499 | virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; } |
| 13500 | }; |
| 13501 | |
| 13502 | #if GTEST_HAS_EXCEPTIONS |
| 13503 |
nothing calls this directly
no outgoing calls
no test coverage detected