Changes imported from Abseil "staging" branch:
- 0a519d9a4507158267cc515e0c7c83959d94fc78 Fix missing header include when compiling with _GLIBCXX_D... by Alex Strelnikov <strel@google.com> - d089af70781d92af9a5de2d84c417ddf2c87689a Internal change by Gennadiy Rozental <rogeeff@google.com> - 0d3afc89d3907923ede964d58c6bcca579e8ad65 Test absl::any for exception safety. This test is tempor... by Jon Cohen <cohenjon@google.com> - 29af424b8a3174a7b3e657e478aa30a8a425aee2 Tweak the ABSL type trait library and expand its tests. by Abseil Team <absl-team@google.com> - 99ab42b2ebbe466cc3730fb6b16b5fad848f95af Rollback GLIBCXX_DEBUG fix due to internal breakage. by Alex Strelnikov <strel@google.com> - 1a5bcb93ee16d4dd2170254e54c4b62b38fbf17b Internal change. by Abseil Team <absl-team@google.com> - 46de7d09c7d4aef5b7b5389ce9b4f96b654aac02 absl::string_view::rfind: doc fix. by Abseil Team <absl-team@google.com> - edda4c7ddd2d76fbb5b3fd5226b95082083c57d9 Fix string_view_test with c++17/clang/libc++ to address by Xiaoyi Zhang <zhangxy@google.com> GitOrigin-RevId: 0a519d9a4507158267cc515e0c7c83959d94fc78 Change-Id: Ie27de1be3e79bba011f05e924d34e8fcc62d8de5
This commit is contained in:
parent
0271cd3557
commit
4132ce2595
14 changed files with 724 additions and 191 deletions
|
|
@ -63,7 +63,7 @@ TEST_F(ThrowingValueTest, Throws) {
|
|||
// the countdown doesn't hit 0, and doesn't modify the state of the
|
||||
// ThrowingValue if it throws
|
||||
template <typename F>
|
||||
void TestOp(F&& f) {
|
||||
void TestOp(const F& f) {
|
||||
UnsetCountdown();
|
||||
ExpectNoThrow(f);
|
||||
|
||||
|
|
@ -153,11 +153,21 @@ TEST_F(ThrowingValueTest, ThrowingStreamOps) {
|
|||
TestOp([&]() { std::cout << bomb; });
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
void TestAllocatingOp(const F& f) {
|
||||
UnsetCountdown();
|
||||
ExpectNoThrow(f);
|
||||
|
||||
SetCountdown();
|
||||
EXPECT_THROW(f(), exceptions_internal::TestBadAllocException);
|
||||
UnsetCountdown();
|
||||
}
|
||||
|
||||
TEST_F(ThrowingValueTest, ThrowingAllocatingOps) {
|
||||
// make_unique calls unqualified operator new, so these exercise the
|
||||
// ThrowingValue overloads.
|
||||
TestOp([]() { return absl::make_unique<ThrowingValue<>>(1); });
|
||||
TestOp([]() { return absl::make_unique<ThrowingValue<>[]>(2); });
|
||||
TestAllocatingOp([]() { return absl::make_unique<ThrowingValue<>>(1); });
|
||||
TestAllocatingOp([]() { return absl::make_unique<ThrowingValue<>[]>(2); });
|
||||
}
|
||||
|
||||
TEST_F(ThrowingValueTest, NonThrowingMoveCtor) {
|
||||
|
|
@ -399,7 +409,8 @@ struct CallOperator {
|
|||
};
|
||||
|
||||
struct NonNegative {
|
||||
friend testing::AssertionResult AbslCheckInvariants(NonNegative* g) {
|
||||
friend testing::AssertionResult AbslCheckInvariants(
|
||||
NonNegative* g, absl::InternalAbslNamespaceFinder) {
|
||||
if (g->i >= 0) return testing::AssertionSuccess();
|
||||
return testing::AssertionFailure()
|
||||
<< "i should be non-negative but is " << g->i;
|
||||
|
|
@ -503,7 +514,8 @@ struct HasReset : public NonNegative {
|
|||
|
||||
void reset() { i = 0; }
|
||||
|
||||
friend bool AbslCheckInvariants(HasReset* h) {
|
||||
friend bool AbslCheckInvariants(HasReset* h,
|
||||
absl::InternalAbslNamespaceFinder) {
|
||||
h->reset();
|
||||
return h->i == 0;
|
||||
}
|
||||
|
|
@ -591,7 +603,8 @@ struct ExhaustivenessTester {
|
|||
return true;
|
||||
}
|
||||
|
||||
friend testing::AssertionResult AbslCheckInvariants(ExhaustivenessTester*) {
|
||||
friend testing::AssertionResult AbslCheckInvariants(
|
||||
ExhaustivenessTester*, absl::InternalAbslNamespaceFinder) {
|
||||
return testing::AssertionSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue