aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/src/gmock_main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock/src/gmock_main.cc')
-rw-r--r--googlemock/src/gmock_main.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc
index 50d0b426..db35bc37 100644
--- a/googlemock/src/gmock_main.cc
+++ b/googlemock/src/gmock_main.cc
@@ -34,16 +34,18 @@
#ifdef ARDUINO
void setup() {
- int argc = 0;
- char** argv = nullptr;
- // Since Google Mock depends on Google Test, InitGoogleMock() is
+ // 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;
+
+ // Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// no need for calling testing::InitGoogleTest() separately.
testing::InitGoogleMock(&argc, argv);
}
-void loop() {
- RUN_ALL_TESTS();
-}
+void loop() { RUN_ALL_TESTS(); }
#else
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
@@ -67,4 +69,3 @@ GTEST_API_ int main(int argc, char** argv) {
return RUN_ALL_TESTS();
}
#endif
-