What's the way to access argc and argv inside of a test case in Google Test framework?

后端 未结 3 506
予麋鹿
予麋鹿 2021-01-11 14:42

I’m using Google Test to test my C++ project. Some cases, however, require access to argc and argv to load the required data.

In the main() method, when

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-11 15:17

    The command line arguments to your test executable are for the test framework, not for your tests. With them, you set stuff like --gtest_output, --gtest_repeat or --gtest_filter. A test should first and foremost be reproducable, which it isn't if it is depending on someone using the "right" parameters.

    What are you trying to achieve, anyway?

提交回复
热议问题