summaryrefslogtreecommitdiffstats
path: root/googletest/src
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2019-01-23 18:27:15 (GMT)
committerGennadiy Civil <misterg@google.com>2019-01-23 18:27:16 (GMT)
commitbf07131c1d0a4e001daeee8936089f8b438b7f30 (patch)
treed7513843f4281a30b265fe196869a25f6d2e1cca /googletest/src
parentfdc59ffd050af9ba60a031b2799fc3f5caba1330 (diff)
parent45c58aa6f3608224975f433e1f4e4b53aa34f97c (diff)
downloadgoogletest-bf07131c1d0a4e001daeee8936089f8b438b7f30.zip
googletest-bf07131c1d0a4e001daeee8936089f8b438b7f30.tar.gz
googletest-bf07131c1d0a4e001daeee8936089f8b438b7f30.tar.bz2
Merge pull request #2041 from ciband:chore/fix_library_json
PiperOrigin-RevId: 230554814
Diffstat (limited to 'googletest/src')
-rw-r--r--googletest/src/gtest.cc16
-rw-r--r--googletest/src/gtest_main.cc8
2 files changed, 17 insertions, 7 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 23b6e5f..d1cfb53 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -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_();
diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc
index 5b94d60..f6e1dd9 100644
--- a/googletest/src/gtest_main.cc
+++ b/googletest/src/gtest_main.cc
@@ -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(); }