diff options
author | Gennadiy Civil <misterg@google.com> | 2019-01-23 18:27:15 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-01-23 18:27:16 (GMT) |
commit | bf07131c1d0a4e001daeee8936089f8b438b7f30 (patch) | |
tree | d7513843f4281a30b265fe196869a25f6d2e1cca /googlemock | |
parent | fdc59ffd050af9ba60a031b2799fc3f5caba1330 (diff) | |
parent | 45c58aa6f3608224975f433e1f4e4b53aa34f97c (diff) | |
download | googletest-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 'googlemock')
-rw-r--r-- | googlemock/include/gmock/gmock.h | 4 | ||||
-rw-r--r-- | googlemock/src/gmock.cc | 12 | ||||
-rw-r--r-- | googlemock/src/gmock_main.cc | 8 |
3 files changed, 17 insertions, 7 deletions
diff --git a/googlemock/include/gmock/gmock.h b/googlemock/include/gmock/gmock.h index c68ae1c..7096984 100644 --- a/googlemock/include/gmock/gmock.h +++ b/googlemock/include/gmock/gmock.h @@ -92,6 +92,10 @@ GTEST_API_ void InitGoogleMock(int* argc, char** argv); // UNICODE mode. GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv); +// This overloaded version can be used on Arduino/embedded platforms where +// there is no argc/argv. +GTEST_API_ void InitGoogleMock(); + } // namespace testing #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_ diff --git a/googlemock/src/gmock.cc b/googlemock/src/gmock.cc index 3fd2e93..05566e2 100644 --- a/googlemock/src/gmock.cc +++ b/googlemock/src/gmock.cc @@ -198,4 +198,16 @@ GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) { internal::InitGoogleMockImpl(argc, argv); } +// This overloaded version can be used on Arduino/embedded platforms where +// there is no argc/argv. +GTEST_API_ void InitGoogleMock() { + // 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; + + internal::InitGoogleMockImpl(&argc, argv); +} + } // namespace testing diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index db35bc3..98611b9 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -34,16 +34,10 @@ #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); + testing::InitGoogleMock(); } void loop() { RUN_ALL_TESTS(); } #else |