Support mapping no-arg functions for void expecteds

This commit is contained in:
Simon Brand
2018-08-24 10:08:20 +01:00
parent d7cf0688f1
commit 4aa086e242
2 changed files with 36 additions and 0 deletions
+10
View File
@@ -572,3 +572,13 @@ TEST_CASE("14", "[issue.14]") {
});
}
TEST_CASE("32", "[issue.32]") {
int i = 0;
tl::expected<void, int> a;
a.map([&i]{i = 42;});
REQUIRE(i == 42);
auto x = a.map([]{return 42;});
REQUIRE(*x == 42);
}