diff options
author | Abseil Team <absl-team@google.com> | 2018-04-26 06:47:58 -0700 |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2018-04-26 11:05:43 -0400 |
commit | 28f5b890702139effabf3576f20e1a4db4a90a80 (patch) | |
tree | a063698e44f3bb6ad708fcf290a05d1af3ea9aa6 /absl/types | |
parent | ea0e750e52ee223db34a242f9a7229ac04a0f473 (diff) |
- 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
Diffstat (limited to 'absl/types')
-rw-r--r-- | absl/types/any_exception_safety_test.cc | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/absl/types/any_exception_safety_test.cc b/absl/types/any_exception_safety_test.cc index 82c176b5..7a72e726 100644 --- a/absl/types/any_exception_safety_test.cc +++ b/absl/types/any_exception_safety_test.cc @@ -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() |