object-introspection/test/main.cpp

20 lines
619 B
C++
Raw Normal View History

#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();
}