Loading CMakeLists.txt +3 −11 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ if(SLED_BUILD_TESTS) sled_add_test( NAME sled_base_test sled_all_tests SRCS src/sled/async/async_test.cc src/sled/any_test.cc Loading @@ -161,6 +161,8 @@ if(SLED_BUILD_TESTS) src/sled/cleanup_test.cc src/sled/status_test.cc src/sled/status_or_test.cc src/sled/strings/utils_test.cc src/sled/strings/base64_test.cc src/sled/system/fiber/fiber_test.cc src/sled/system/thread_pool_test.cc src/sled/rx_test.cc Loading @@ -169,16 +171,6 @@ if(SLED_BUILD_TESTS) sled GTest::gtest_main) sled_add_test( NAME sled_strings_test SRCS src/sled/strings/utils_test.cc src/sled/strings/base64_test.cc LIBS sled GTest::gtest_main) sled_add_test(NAME sled_symbolize_test SRCS src/sled/debugging/symbolize_test.cc LIBS sled) endif(SLED_BUILD_TESTS) Loading src/sled/status_or.h +20 −6 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #pragma once #ifndef SLED_STATUS_OR_H #define SLED_STATUS_OR_H #include "sled/lang/attributes.h" #include "sled/optional.h" #include "sled/status.h" #include <stdexcept> Loading Loading @@ -160,19 +161,32 @@ operator!=(StatusOr<T> const &a, StatusOr<T> const &b) } template<typename T> StatusOr<T> SLED_DEPRECATED StatusOr<T> make_status_or(T rhs) { return StatusOr<T>(std::move(rhs)); } template<typename T> StatusOr<T> SLED_DEPRECATED StatusOr<T> make_status_or(StatusCode code, std::string message = "", ErrorInfo info = {}) { return StatusOr<T>(Status(code, std::move(message))); } template<typename T> StatusOr<T> MakeStatusOr(T rhs) { return StatusOr<T>(std::move(rhs)); } template<typename T> StatusOr<T> MakeStatusOr(StatusCode code, std::string message = "", ErrorInfo info = {}) { return StatusOr<T>(Status(code, std::move(message))); } }// namespace sled #endif// SLED_STATUS_OR_H src/sled/status_or_test.cc +2 −2 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ TEST(StatusOr, TestStatusOr) TEST(StatusOr, make_status_or) { auto from_raw_str = sled::make_status_or("hello"); auto from_string = sled::make_status_or(std::string("world")); auto from_raw_str = sled::MakeStatusOr("hello"); auto from_string = sled::MakeStatusOr(std::string("world")); EXPECT_TRUE(from_raw_str.ok()); EXPECT_TRUE(from_string.ok()); EXPECT_EQ(from_raw_str.value(), "hello"); Loading Loading
CMakeLists.txt +3 −11 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ if(SLED_BUILD_TESTS) sled_add_test( NAME sled_base_test sled_all_tests SRCS src/sled/async/async_test.cc src/sled/any_test.cc Loading @@ -161,6 +161,8 @@ if(SLED_BUILD_TESTS) src/sled/cleanup_test.cc src/sled/status_test.cc src/sled/status_or_test.cc src/sled/strings/utils_test.cc src/sled/strings/base64_test.cc src/sled/system/fiber/fiber_test.cc src/sled/system/thread_pool_test.cc src/sled/rx_test.cc Loading @@ -169,16 +171,6 @@ if(SLED_BUILD_TESTS) sled GTest::gtest_main) sled_add_test( NAME sled_strings_test SRCS src/sled/strings/utils_test.cc src/sled/strings/base64_test.cc LIBS sled GTest::gtest_main) sled_add_test(NAME sled_symbolize_test SRCS src/sled/debugging/symbolize_test.cc LIBS sled) endif(SLED_BUILD_TESTS) Loading
src/sled/status_or.h +20 −6 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #pragma once #ifndef SLED_STATUS_OR_H #define SLED_STATUS_OR_H #include "sled/lang/attributes.h" #include "sled/optional.h" #include "sled/status.h" #include <stdexcept> Loading Loading @@ -160,19 +161,32 @@ operator!=(StatusOr<T> const &a, StatusOr<T> const &b) } template<typename T> StatusOr<T> SLED_DEPRECATED StatusOr<T> make_status_or(T rhs) { return StatusOr<T>(std::move(rhs)); } template<typename T> StatusOr<T> SLED_DEPRECATED StatusOr<T> make_status_or(StatusCode code, std::string message = "", ErrorInfo info = {}) { return StatusOr<T>(Status(code, std::move(message))); } template<typename T> StatusOr<T> MakeStatusOr(T rhs) { return StatusOr<T>(std::move(rhs)); } template<typename T> StatusOr<T> MakeStatusOr(StatusCode code, std::string message = "", ErrorInfo info = {}) { return StatusOr<T>(Status(code, std::move(message))); } }// namespace sled #endif// SLED_STATUS_OR_H
src/sled/status_or_test.cc +2 −2 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ TEST(StatusOr, TestStatusOr) TEST(StatusOr, make_status_or) { auto from_raw_str = sled::make_status_or("hello"); auto from_string = sled::make_status_or(std::string("world")); auto from_raw_str = sled::MakeStatusOr("hello"); auto from_string = sled::MakeStatusOr(std::string("world")); EXPECT_TRUE(from_raw_str.ok()); EXPECT_TRUE(from_string.ok()); EXPECT_EQ(from_raw_str.value(), "hello"); Loading