aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/src
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-12-14 13:54:42 -0500
committerGennadiy Civil <misterg@google.com>2018-12-14 13:54:43 -0500
commitb5f5c596a9915106c1ac36a3f89db4e0e49c07d1 (patch)
tree2bc11702641f6bcca31032b4c343238d7b9178f6 /googlemock/src
parentc6cb7e033591528a5fe2c63157a0d8ce927740dc (diff)
parent31eb5e9b873af4b509be2f77616113007fa0de9d (diff)
downloadgoogletest-b5f5c596a9915106c1ac36a3f89db4e0e49c07d1.tar.gz
googletest-b5f5c596a9915106c1ac36a3f89db4e0e49c07d1.tar.bz2
googletest-b5f5c596a9915106c1ac36a3f89db4e0e49c07d1.zip
Merge pull request #2000 from ciband:feat/add_support_platformio
PiperOrigin-RevId: 225552792
Diffstat (limited to 'googlemock/src')
-rw-r--r--googlemock/src/gmock_main.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc
index a3a271e6..db35bc37 100644
--- a/googlemock/src/gmock_main.cc
+++ b/googlemock/src/gmock_main.cc
@@ -32,6 +32,22 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#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;
+
+ // 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(); }
+#else
+
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
// causes a link error when _tmain is defined in a static library and UNICODE
// is enabled. For this reason instead of _tmain, main function is used on
@@ -52,3 +68,4 @@ GTEST_API_ int main(int argc, char** argv) {
testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
+#endif