| 198 | }; |
| 199 | |
| 200 | class GMockTestTerminator : public TestTerminator |
| 201 | { |
| 202 | public: |
| 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 | } |
| 233 | private: |
| 234 | const ::testing::TestPartResult& result_; |
| 235 | }; |
| 236 | |
| 237 | |
| 238 | class GTestResultReporter : public ::testing::ScopedFakeTestPartResultReporter |
no outgoing calls