This commit is contained in:
Simon Brand
2018-09-03 08:41:42 +01:00
parent 7b7519ff4a
commit 03689e9d21
2 changed files with 16 additions and 7 deletions
+11
View File
@@ -80,3 +80,14 @@ TEST_CASE("Issue 33", "[issues.33]") {
res = res.map_error([](int i) { return 42; });
REQUIRE(res.error() == 42);
}
tl::expected<void, std::string> voidWork() { return {}; }
tl::expected<int, std::string> work2() { return 42; }
void errorhandling(std::string){}
TEST_CASE("Issue 34", "[issues.34]") {
tl::expected <int, std::string> result = voidWork ()
.and_then (work2);
result.map_error ([&] (std::string result) {errorhandling (result);});
}