Support mapping no-arg functions for void expecteds

This commit is contained in:
Simon Brand committed 2018-08-24 10:08:20 +01:00
1 parent d7cf0688f1
commit 4aa086e242
2 files changed
+36

No files matched your search

+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);
}