Merge pull request #2041 from ciband:chore/fix_library_json

PiperOrigin-RevId: 230554814
This commit is contained in:
Gennadiy Civil
2019-01-23 13:27:15 -05:00
9 changed files with 68 additions and 16 deletions

View File

@@ -1484,6 +1484,10 @@ GTEST_API_ void InitGoogleTest(int* argc, char** argv);
// UNICODE mode.
GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
// This overloaded version can be used on Arduino/embedded platforms where
// there is no argc/argv.
GTEST_API_ void InitGoogleTest();
namespace internal {
// Separate the error generating code from the code path to reduce the stack

View File

@@ -6020,6 +6020,22 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
}
// This overloaded version can be used on Arduino/embedded platforms where
// there is no argc/argv.
void InitGoogleTest() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "dummy";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(&argc, argv);
#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
internal::InitGoogleTestImpl(&argc, argv);
#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
}
std::string TempDir() {
#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
return GTEST_CUSTOM_TEMPDIR_FUNCTION_();

View File

@@ -32,13 +32,7 @@
#ifdef ARDUINO
void setup() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "PlatformIO";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleTest();
}
void loop() { RUN_ALL_TESTS(); }