MCPcopy Create free account
hub / github.com/cpputest/cpputest / GMockTestTerminator

Class GMockTestTerminator

include/CppUTestExt/GTestConvertor.h:200–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198};
199
200class GMockTestTerminator : public TestTerminator
201{
202public:
203 GMockTestTerminator(const ::testing::TestPartResult& result) : result_(result)
204 {
205 }
206
207 virtual void exitCurrentTest() const
208 {
209 /*
210 * When using GMock, it throws an exception fromt he destructor leaving
211 * the system in an unstable state.
212 * Therefore, when the test fails because of failed gmock expectation
213 * then don't throw the exception, but let it return. Usually this should
214 * already be at the end of the test, so it doesn't matter much
215 */
216
217
218 /*
219 * TODO: We probably want this check here, however the tests fail when putting it there. Also, we'll need to
220 * check how to get all the gTest tests to run within CppUTest. At the moment, the 'death tests' seem to fail
221 * still.
222 *
223 * if (result_.type() == ::testing::TestPartResult::kFatalFailure) {
224 */
225 if (!SimpleString(result_.message()).contains("Actual: never called") &&
226 !SimpleString(result_.message()).contains("Actual function call count doesn't match"))
227 throw CppUTestFailedException();
228
229 }
230 virtual ~GMockTestTerminator()
231 {
232 }
233private:
234 const ::testing::TestPartResult& result_;
235};
236
237
238class GTestResultReporter : public ::testing::ScopedFakeTestPartResultReporter

Callers 1

ReportTestPartResultMethod · 0.85

Calls

no outgoing calls

Tested by 1

ReportTestPartResultMethod · 0.68