aboutsummaryrefslogtreecommitdiff
path: root/test.cpp
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2018-02-01 01:22:16 -0500
committerDeterminant <ted.sybil@gmail.com>2018-02-01 01:22:16 -0500
commit42b76a0e722237567720fea53ba2a14b8d81faf8 (patch)
tree725587fb1284ed944eef1202d1cf0fe120ca1831 /test.cpp
parent4900f7a7533ca0d70db7dd5cb40d3fc8c5996a04 (diff)
...
Diffstat (limited to 'test.cpp')
-rw-r--r--test.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/test.cpp b/test.cpp
index 2719340..df96207 100644
--- a/test.cpp
+++ b/test.cpp
@@ -2,12 +2,25 @@
#include "promise.hpp"
using promise::promise_t;
+struct A {
+ promise::None operator()(int y) const {
+ printf("%d\n", y);
+ return promise::none;
+ }
+};
+
+int f(int x) {
+ printf("%d\n", x);
+ return x + 1;
+}
+
int main() {
std::function<void()> t1;
std::function<void()> t2;
std::function<void()> t3;
std::function<void()> t4;
std::function<void()> t5;
+ A a;
auto pm = promise_t([&t1](promise_t pm) {
puts("pm1");
//t1 = [pm]() {pm.reject(5);};
@@ -29,8 +42,8 @@ int main() {
return 10;
}).then([](int x) {
printf("%d\n", x);
- return promise::none;
- });
+ return 12;
+ }).then(f).then(a);
auto p1 = promise_t([&t4](promise_t pm) {
puts("p1");