Merge remote-tracking branch 'origin/master'
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 2m6s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 2m17s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 2m13s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 2m16s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 2m33s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m24s
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 2m6s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 2m17s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 2m13s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 2m16s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 2m33s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m24s
This commit is contained in:
commit
85852ee2e9
@ -267,7 +267,7 @@ public:
|
||||
result.FillFailure(future_detail::ExceptionFailure<FailureT>());
|
||||
}
|
||||
});
|
||||
OnFailure([result](const FailureT &failure) noexcept { result.FillFailure(failure); });
|
||||
OnFailure([result](const FailureT &failure) mutable noexcept { result.FillFailure(failure); });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,24 @@ TEST_SUITE("future")
|
||||
CHECK_EQ(f.Result(), 42);
|
||||
}
|
||||
|
||||
TEST_CASE("base failed")
|
||||
TEST_CASE("base success 1")
|
||||
{
|
||||
sled::Promise<int, std::string> p;
|
||||
auto f = p.GetFuture();
|
||||
auto f = p.GetFuture().OnSuccess([](int i) { CHECK_EQ(i, 42); }).OnFailure([](const std::string &) {
|
||||
REQUIRE(false);
|
||||
});
|
||||
p.Success(42);
|
||||
CHECK(f.Wait(-1));
|
||||
CHECK(f.IsValid());
|
||||
CHECK_EQ(f.Result(), 42);
|
||||
}
|
||||
|
||||
TEST_CASE("base failed 1")
|
||||
{
|
||||
sled::Promise<int, std::string> p;
|
||||
auto f = p.GetFuture().OnFailure([](const std::string &str) { CHECK_EQ(str, "error"); }).OnSuccess([](int) {
|
||||
REQUIRE(false);
|
||||
});
|
||||
p.Failure("error");
|
||||
REQUIRE(p.IsFilled());
|
||||
REQUIRE(f.IsCompleted());
|
||||
@ -39,7 +53,7 @@ TEST_SUITE("future")
|
||||
REQUIRE(f.IsFailed());
|
||||
CHECK_EQ(f.FailureReason(), "test");
|
||||
}
|
||||
|
||||
//
|
||||
TEST_CASE("base failed")
|
||||
{
|
||||
sled::Promise<int, std::string> p;
|
||||
|
@ -54,6 +54,21 @@ FailureFromString<DefaultException>(const std::string &str)
|
||||
return DefaultException(str);
|
||||
}
|
||||
|
||||
// template<>
|
||||
// inline std::string
|
||||
// FailureFromString<std::string>(std::string &&str)
|
||||
// {
|
||||
// return std::move(str);
|
||||
// }
|
||||
|
||||
// template<typename FailureT,
|
||||
// typename = typename std::enable_if<std::is_constructible<FailureT, std::string>::value>::type>
|
||||
// inline FailureT
|
||||
// FailureFromString(std::string &&str)
|
||||
// {
|
||||
// return FailureT(std::move(str));
|
||||
// }
|
||||
|
||||
}// namespace failure
|
||||
|
||||
namespace future_detail {
|
||||
|
Loading…
x
Reference in New Issue
Block a user