diff options
Diffstat (limited to 'async/autotests/asynctest.cpp')
-rw-r--r-- | async/autotests/asynctest.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/async/autotests/asynctest.cpp b/async/autotests/asynctest.cpp index 19e40f7..403fb83 100644 --- a/async/autotests/asynctest.cpp +++ b/async/autotests/asynctest.cpp | |||
@@ -91,18 +91,21 @@ void AsyncTest::testAsyncPromises() | |||
91 | 91 | ||
92 | void AsyncTest::testSyncEach() | 92 | void AsyncTest::testSyncEach() |
93 | { | 93 | { |
94 | /* | ||
95 | auto job = Async::start<QList<int>>( | 94 | auto job = Async::start<QList<int>>( |
96 | []() -> Async::Future<QList<int>> { | 95 | [](Async::Future<QList<int>> &future) { |
97 | Async::Future<QList<int>> future(QList<int>{ 1, 2, 3, 4 }); | 96 | future.setValue(QList<int>{ 1, 2, 3, 4 }); |
98 | future.setFinished(); | 97 | future.setFinished(); |
99 | return future; | ||
100 | }) | 98 | }) |
101 | .each<QList<int>, int>( | 99 | .each<QList<int>, int>( |
102 | [](const int &v, Async::Future<QList<int>> &future) { | 100 | [](const int &v, Async::Future<QList<int>> &future) { |
103 | setFinished(); | 101 | future.setValue(QList<int>{ v + 1 }); |
102 | future.setFinished(); | ||
104 | }); | 103 | }); |
105 | */ | 104 | |
105 | job.exec(); | ||
106 | Async::Future<QList<int>> future = job.result(); | ||
107 | const QList<int> expected({ 2, 3, 4, 5 }); | ||
108 | QCOMPARE(future.value(), expected); | ||
106 | } | 109 | } |
107 | 110 | ||
108 | 111 | ||