mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
20 lines
619 B
C++
20 lines
619 B
C++
#include <gtest/gtest.h>
|
|
|
|
/*
|
|
* This listener ensures that test failures (ASSERTs) in helper functions
|
|
* propagate all the way up and stop the test from continuing.
|
|
*/
|
|
class ThrowListener : public testing::EmptyTestEventListener {
|
|
void OnTestPartResult(const testing::TestPartResult& result) override {
|
|
if (result.type() == testing::TestPartResult::kFatalFailure) {
|
|
throw testing::AssertionException(result);
|
|
}
|
|
}
|
|
};
|
|
|
|
int main(int argc, char* argv[]) {
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
::testing::UnitTest::GetInstance()->listeners().Append(new ThrowListener);
|
|
return RUN_ALL_TESTS();
|
|
}
|