- 81cdce434ff1bd8fa54c832a11dda59af46e79cc Adds a failure signal handler to Abseil. by Derek Mauro <dmauro@google.com>

- 40a973dd1b159e7455dd5fc06ac2d3f494d72c3e Remove test fixture requirement for ExceptionSafetyTester... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 81cdce434ff1bd8fa54c832a11dda59af46e79cc
Change-Id: Ia9fca98e38f229b68f7ec45600dee1bbd5dcff33
This commit is contained in:
Abseil Team 2018-04-26 06:47:58 -07:00 committed by Derek Mauro
parent ea0e750e52
commit 28f5b89070
8 changed files with 792 additions and 105 deletions

View file

@ -30,11 +30,6 @@ using ThrowingThrowerVec = std::vector<Thrower, ThrowingAlloc>;
namespace {
class AnyExceptionSafety : public ::testing::Test {
private:
absl::ConstructorTracker inspector_;
};
testing::AssertionResult AnyInvariants(absl::any* a) {
using testing::AssertionFailure;
using testing::AssertionSuccess;
@ -84,22 +79,24 @@ testing::AssertionResult AnyIsEmpty(absl::any* a) {
<< absl::any_cast<Thrower>(*a).Get();
}
TEST_F(AnyExceptionSafety, Ctors) {
TEST(AnyExceptionSafety, Ctors) {
Thrower val(1);
auto with_val = absl::TestThrowingCtor<absl::any>(val);
auto copy = absl::TestThrowingCtor<absl::any>(with_val);
auto in_place =
absl::TestThrowingCtor<absl::any>(absl::in_place_type_t<Thrower>(), 1);
auto in_place_list = absl::TestThrowingCtor<absl::any>(
absl::in_place_type_t<ThrowerVec>(), ThrowerList{val});
auto in_place_list_again =
absl::TestThrowingCtor<absl::any,
absl::in_place_type_t<ThrowingThrowerVec>,
ThrowerList, ThrowingAlloc>(
absl::in_place_type_t<ThrowingThrowerVec>(), {val}, ThrowingAlloc());
absl::TestThrowingCtor<absl::any>(val);
Thrower copy(val);
absl::TestThrowingCtor<absl::any>(copy);
absl::TestThrowingCtor<absl::any>(absl::in_place_type_t<Thrower>(), 1);
absl::TestThrowingCtor<absl::any>(absl::in_place_type_t<ThrowerVec>(),
ThrowerList{val});
absl::TestThrowingCtor<absl::any, absl::in_place_type_t<ThrowingThrowerVec>,
ThrowerList, ThrowingAlloc>(
absl::in_place_type_t<ThrowingThrowerVec>(), {val}, ThrowingAlloc());
}
TEST_F(AnyExceptionSafety, Assignment) {
TEST(AnyExceptionSafety, Assignment) {
auto original =
absl::any(absl::in_place_type_t<Thrower>(), 1, absl::no_throw_ctor);
auto any_is_strong = [original](absl::any* ap) {
@ -139,7 +136,7 @@ TEST_F(AnyExceptionSafety, Assignment) {
}
// libstdc++ std::any fails this test
#if !defined(ABSL_HAVE_STD_ANY)
TEST_F(AnyExceptionSafety, Emplace) {
TEST(AnyExceptionSafety, Emplace) {
auto initial_val =
absl::any{absl::in_place_type_t<Thrower>(), 1, absl::no_throw_ctor};
auto one_tester = absl::MakeExceptionSafetyTester()