b69c7d880c
-- 00f5301405423005d9129935c05f20155536cc1a by CJ Johnson <johnsoncj@google.com>: Removes usage of std::aligned_storage from Abseil implementation details PiperOrigin-RevId: 296492301 -- fc11d15f91764612fba080669d2381dc181df52b by Abseil Team <absl-team@google.com>: Fix absl::bind_front documentation. PiperOrigin-RevId: 296482945 -- 0164c595c129c46bf21ae74eba5399a1da5f140b by Gennadiy Rozental <rogeeff@google.com>: Automated g4 rollback of changelist 296320700. PiperOrigin-RevId: 296439968 -- 1eb295700758ca0894d872b2de7c675b4ad679af by Abseil Team <absl-team@google.com>: Removes duplicate comments. PiperOrigin-RevId: 296433214 -- c30c01caae02d2fa4ef783d988de6bebb9757c39 by Derek Mauro <dmauro@google.com>: Merge GitHub #621: Add RISCV support to GetProgramCounter() Fixes #621 PiperOrigin-RevId: 296351174 -- 95d4498167596fd7543e025bdfe9a8da9e2ca3c8 by Abseil Team <absl-team@google.com>: Automated g4 rollback of changelist 296320700. PiperOrigin-RevId: 296348701 -- b193f0543e0cec54dddb2ed51f45dc489c8d06d5 by Gennadiy Rozental <rogeeff@google.com>: Change TryParse interface to return managed value. In addition introduce companion StoreValue routine which consumes pointer to source value and stores the value inside of FlagImpl. In a follow up CL we will change StoreValue implementation to behave differently depending on "value storage kind". We also rename default_src_ to default_value_. PiperOrigin-RevId: 296320700 -- 57e942b485d12912a0a8d0d0b35fa2a62847020f by Derek Mauro <dmauro@google.com>: Merge GitHub #622 * Add missing #ifdef conditionals for ABSL_HAVE_VDSO_SUPPORT PiperOrigin-RevId: 296272830 GitOrigin-RevId: 00f5301405423005d9129935c05f20155536cc1a Change-Id: I1b05eeaf1280f95fb0a2c5f3654995a87c792893
57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
// Copyright 2018 The Abseil Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include "absl/memory/memory.h"
|
|
|
|
#include "absl/base/config.h"
|
|
|
|
#ifdef ABSL_HAVE_EXCEPTIONS
|
|
|
|
#include "gtest/gtest.h"
|
|
#include "absl/base/internal/exception_safety_testing.h"
|
|
|
|
namespace absl {
|
|
ABSL_NAMESPACE_BEGIN
|
|
namespace {
|
|
|
|
constexpr int kLength = 50;
|
|
using Thrower = testing::ThrowingValue<testing::TypeSpec::kEverythingThrows>;
|
|
|
|
TEST(MakeUnique, CheckForLeaks) {
|
|
constexpr int kValue = 321;
|
|
auto tester = testing::MakeExceptionSafetyTester()
|
|
.WithInitialValue(Thrower(kValue))
|
|
// Ensures make_unique does not modify the input. The real
|
|
// test, though, is ConstructorTracker checking for leaks.
|
|
.WithContracts(testing::strong_guarantee);
|
|
|
|
EXPECT_TRUE(tester.Test([](Thrower* thrower) {
|
|
static_cast<void>(absl::make_unique<Thrower>(*thrower));
|
|
}));
|
|
|
|
EXPECT_TRUE(tester.Test([](Thrower* thrower) {
|
|
static_cast<void>(absl::make_unique<Thrower>(std::move(*thrower)));
|
|
}));
|
|
|
|
// Test T[n] overload
|
|
EXPECT_TRUE(tester.Test([&](Thrower*) {
|
|
static_cast<void>(absl::make_unique<Thrower[]>(kLength));
|
|
}));
|
|
}
|
|
|
|
} // namespace
|
|
ABSL_NAMESPACE_END
|
|
} // namespace absl
|
|
|
|
#endif // ABSL_HAVE_EXCEPTIONS
|