about summary refs log tree commit diff
path: root/absl/base/exception_safety_testing_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-24T01·09-0700
committerAshley Hedberg <ahedberg@google.com>2018-10-24T20·47-0400
commit94c298e2a0ae409e283cab96c954a685bd865a70 (patch)
tree61581c5b86e25d374cf6abb2ae11e8850367ffe8 /absl/base/exception_safety_testing_test.cc
parent8efc52608700647d7bd5ef55ef2487af1ecdaa7c (diff)
Export of internal Abseil changes.
--
441d1aa02483cdc510eb2fef012b31384fd8e3a6 by Eric Fiselier <ericwf@google.com>:

Fix str_format with non-POSIX libc implementations.

PiperOrigin-RevId: 218441122

--
da6190130e74222af6eb161a5593364341370370 by Jon Cohen <cohenjon@google.com>:

Refactor ExceptionSafetyTester::Test in order to remove the levels of indirection related to unpacking tuples.

PiperOrigin-RevId: 218403355
GitOrigin-RevId: 441d1aa02483cdc510eb2fef012b31384fd8e3a6
Change-Id: I6f6b978eb96fe261e8ee41ecdce185e5356a601d
Diffstat (limited to 'absl/base/exception_safety_testing_test.cc')
-rw-r--r--absl/base/exception_safety_testing_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc
index 106bc34b00f7..7518264d2ec5 100644
--- a/absl/base/exception_safety_testing_test.cc
+++ b/absl/base/exception_safety_testing_test.cc
@@ -770,6 +770,18 @@ TEST(ExceptionCheckTest, ModifyingChecker) {
                   .Test(invoker));
 }
 
+TEST(ExceptionSafetyTesterTest, ResetsCountdown) {
+  auto test =
+      testing::MakeExceptionSafetyTester()
+          .WithInitialValue(ThrowingValue<>())
+          .WithContracts([](ThrowingValue<>*) { return AssertionSuccess(); })
+          .WithOperation([](ThrowingValue<>*) {});
+  ASSERT_TRUE(test.Test());
+  // If the countdown isn't reset because there were no exceptions thrown, then
+  // this will fail with a termination from an unhandled exception
+  EXPECT_TRUE(test.Test());
+}
+
 struct NonCopyable : public NonNegative {
   NonCopyable(const NonCopyable&) = delete;
   NonCopyable() : NonNegative{0} {}