diff options
author | Chris <chrisjohnsonmail@gmail.com> | 2019-01-07 18:37:34 (GMT) |
---|---|---|
committer | Chris <chrisjohnsonmail@gmail.com> | 2019-01-07 18:37:34 (GMT) |
commit | 45c58aa6f3608224975f433e1f4e4b53aa34f97c (patch) | |
tree | 29025f5e757fdcfaef94a91ca40044e8d0ed0c0a /googlemock/src/gmock_main.cc | |
parent | 23e693787399d5d95b25f1e0078419e9b3d921b8 (diff) | |
download | googletest-45c58aa6f3608224975f433e1f4e4b53aa34f97c.zip googletest-45c58aa6f3608224975f433e1f4e4b53aa34f97c.tar.gz googletest-45c58aa6f3608224975f433e1f4e4b53aa34f97c.tar.bz2 |
fix: Add Arduino setup()/loop() functions back
Added setup()/loop() functions back to *_main.cc files to support compiling in CI. Future features could enable this for the end user.
Diffstat (limited to 'googlemock/src/gmock_main.cc')
-rw-r--r-- | googlemock/src/gmock_main.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index a3a271e..3306ffc 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -32,6 +32,18 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#ifdef ARDUINO +void setup() { + int argc = 0; + char** argv = nullptr; + // 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 +64,5 @@ GTEST_API_ int main(int argc, char** argv) { testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } + +#endif |