#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/types/expected_macros.h"
#include <memory>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include "base/test/gmock_expected_support.h"
#include "base/types/expected.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
expected<void, std::string> ReturnOk() { … }
expected<int, std::string> ReturnValue(int v) { … }
expected<int, std::string> ReturnError(std::string_view msg) { … }
template <class... Args>
expected<std::tuple<Args...>, std::string> ReturnTupleValue(Args&&... v) { … }
template <class... Args>
expected<std::tuple<Args...>, std::string> ReturnTupleError(
std::string_view msg) { … }
expected<std::unique_ptr<int>, std::string> ReturnPtrValue(int v) { … }
expected<std::string, std::unique_ptr<int>> ReturnPtrError(int v) { … }
TEST(ReturnIfError, Works) { … }
TEST(ReturnIfError, WorksWithExpectedReturn) { … }
TEST(ReturnIfError, WorksWithLambda) { … }
TEST(ReturnIfError, WorksWithMoveOnlyType) { … }
TEST(ReturnIfError, WorksWithMoveOnlyTypeAndExpectedReturn) { … }
TEST(ReturnIfError, WorksWithAdaptorFunc) { … }
TEST(ReturnIfError, WorksWithAdaptorFuncAndExpectedReturn) { … }
TEST(ReturnIfError, WorksWithAdaptorFuncAndMoveOnlyType) { … }
TEST(ReturnIfError, WorksWithAdaptorFuncAndMoveOnlyTypeAndExpectedReturn) { … }
TEST(ReturnIfError, WorksWithVoidReturnAdaptor) { … }
TEST(AssignOrReturn, Works) { … }
TEST(AssignOrReturn, WorksWithExpectedReturn) { … }
TEST(AssignOrReturn, WorksWithLambda) { … }
TEST(AssignOrReturn, WorksWithMoveOnlyType) { … }
TEST(AssignOrReturn, WorksWithMoveOnlyTypeAndExpectedReturn) { … }
TEST(AssignOrReturn, WorksWithCommasInType) { … }
TEST(AssignOrReturn, WorksWithStructuredBindings) { … }
TEST(AssignOrReturn, WorksWithParenthesesAndDereference) { … }
TEST(AssignOrReturn, WorksWithAdaptorFunc) { … }
TEST(AssignOrReturn, WorksWithAdaptorFuncAndExpectedReturn) { … }
TEST(AssignOrReturn, WorksWithAdaptorFuncAndMoveOnlyType) { … }
TEST(AssignOrReturn, WorksWithAdaptorFuncAndMoveOnlyTypeAndExpectedReturn) { … }
TEST(AssignOrReturn, WorksWithVoidReturnAdaptor) { … }
TEST(AssignOrReturn, WorksWithThirdArgumentAndCommas) { … }
TEST(AssignOrReturn, WorksWithAppendIncludingLocals) { … }
TEST(AssignOrReturn, WorksForExistingVariable) { … }
TEST(AssignOrReturn, UniquePtrWorks) { … }
TEST(AssignOrReturn, UniquePtrWorksForExistingVariable) { … }
}
}