summaryrefslogtreecommitdiff
path: root/absl/types/optional_exception_safety_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types/optional_exception_safety_test.cc')
-rw-r--r--absl/types/optional_exception_safety_test.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/absl/types/optional_exception_safety_test.cc b/absl/types/optional_exception_safety_test.cc
index e136d0a0..313891f7 100644
--- a/absl/types/optional_exception_safety_test.cc
+++ b/absl/types/optional_exception_safety_test.cc
@@ -18,7 +18,7 @@
#include "absl/base/internal/exception_safety_testing.h"
namespace absl {
-inline namespace lts_2018_06_20 {
+inline namespace lts_2018_12_18 {
namespace {
@@ -39,12 +39,12 @@ constexpr int kUpdatedInteger = 10;
template <typename OptionalT>
bool ValueThrowsBadOptionalAccess(const OptionalT& optional) try {
return (static_cast<void>(optional.value()), false);
-} catch (absl::bad_optional_access) {
+} catch (const absl::bad_optional_access&) {
return true;
}
template <typename OptionalT>
-AssertionResult CheckInvariants(OptionalT* optional_ptr) {
+AssertionResult OptionalInvariants(OptionalT* optional_ptr) {
// Check the current state post-throw for validity
auto& optional = *optional_ptr;
@@ -124,8 +124,8 @@ TEST(OptionalExceptionSafety, NothrowConstructors) {
TEST(OptionalExceptionSafety, Emplace) {
// Test the basic guarantee plus test the result of optional::has_value()
// is false in all cases
- auto disengaged_test = MakeExceptionSafetyTester().WithInvariants(
- CheckInvariants<Optional>, CheckDisengaged<Optional>);
+ auto disengaged_test = MakeExceptionSafetyTester().WithContracts(
+ OptionalInvariants<Optional>, CheckDisengaged<Optional>);
auto disengaged_test_empty = disengaged_test.WithInitialValue(Optional());
auto disengaged_test_nonempty =
disengaged_test.WithInitialValue(Optional(kInitialInteger));
@@ -148,11 +148,11 @@ TEST(OptionalExceptionSafety, EverythingThrowsSwap) {
// Test the basic guarantee plus test the result of optional::has_value()
// remains the same
auto test =
- MakeExceptionSafetyTester().WithInvariants(CheckInvariants<Optional>);
+ MakeExceptionSafetyTester().WithContracts(OptionalInvariants<Optional>);
auto disengaged_test_empty = test.WithInitialValue(Optional())
- .WithInvariants(CheckDisengaged<Optional>);
+ .WithContracts(CheckDisengaged<Optional>);
auto engaged_test_nonempty = test.WithInitialValue(Optional(kInitialInteger))
- .WithInvariants(CheckEngaged<Optional>);
+ .WithContracts(CheckEngaged<Optional>);
auto swap_empty = [](Optional* optional_ptr) {
auto empty = Optional();
@@ -193,11 +193,11 @@ TEST(OptionalExceptionSafety, CopyAssign) {
// Test the basic guarantee plus test the result of optional::has_value()
// remains the same
auto test =
- MakeExceptionSafetyTester().WithInvariants(CheckInvariants<Optional>);
+ MakeExceptionSafetyTester().WithContracts(OptionalInvariants<Optional>);
auto disengaged_test_empty = test.WithInitialValue(Optional())
- .WithInvariants(CheckDisengaged<Optional>);
+ .WithContracts(CheckDisengaged<Optional>);
auto engaged_test_nonempty = test.WithInitialValue(Optional(kInitialInteger))
- .WithInvariants(CheckEngaged<Optional>);
+ .WithContracts(CheckEngaged<Optional>);
auto copyassign_nonempty = [](Optional* optional_ptr) {
auto nonempty =
@@ -219,11 +219,11 @@ TEST(OptionalExceptionSafety, MoveAssign) {
// Test the basic guarantee plus test the result of optional::has_value()
// remains the same
auto test =
- MakeExceptionSafetyTester().WithInvariants(CheckInvariants<Optional>);
+ MakeExceptionSafetyTester().WithContracts(OptionalInvariants<Optional>);
auto disengaged_test_empty = test.WithInitialValue(Optional())
- .WithInvariants(CheckDisengaged<Optional>);
+ .WithContracts(CheckDisengaged<Optional>);
auto engaged_test_nonempty = test.WithInitialValue(Optional(kInitialInteger))
- .WithInvariants(CheckEngaged<Optional>);
+ .WithContracts(CheckEngaged<Optional>);
auto moveassign_empty = [](Optional* optional_ptr) {
auto empty = Optional();
@@ -280,5 +280,5 @@ TEST(OptionalExceptionSafety, NothrowMoveAssign) {
} // namespace
-} // inline namespace lts_2018_06_20
+} // inline namespace lts_2018_12_18
} // namespace absl