2017-10-30 23:55:37 +01:00
|
|
|
#include "absl/base/internal/exception_safety_testing.h"
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "absl/meta/type_traits.h"
|
|
|
|
|
|
|
|
namespace absl {
|
2017-11-22 16:42:54 +01:00
|
|
|
exceptions_internal::NoThrowTag no_throw_ctor;
|
2017-10-30 23:55:37 +01:00
|
|
|
namespace exceptions_internal {
|
|
|
|
|
|
|
|
int countdown = -1;
|
|
|
|
|
|
|
|
void MaybeThrow(absl::string_view msg) {
|
|
|
|
if (countdown-- == 0) throw TestException(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
testing::AssertionResult FailureMessage(const TestException& e,
|
|
|
|
int countdown) noexcept {
|
2017-11-22 16:42:54 +01:00
|
|
|
return testing::AssertionFailure() << "Exception thrown from " << e.what();
|
2017-10-30 23:55:37 +01:00
|
|
|
}
|
|
|
|
} // namespace exceptions_internal
|
|
|
|
} // namespace absl
|