|
1 | 1 | (ns manifold.deferred-stage-test
|
2 | 2 | (:require [manifold.deferred :as d]
|
| 3 | + [manifold.utils :refer |
| 4 | + [fn->Function fn->Consumer fn->BiFunction fn->BiConsumer]] |
3 | 5 | [clojure.test :refer [deftest is testing]])
|
4 | 6 | (:import [java.util.concurrent
|
5 | 7 | CompletionStage
|
6 | 8 | CompletableFuture
|
7 | 9 | Executors]))
|
8 | 10 |
|
9 |
| -(defn fn->Function [function] |
10 |
| - (reify java.util.function.Function |
11 |
| - (apply [_ x] (function x)))) |
12 |
| - |
13 |
| -(defn fn->Consumer [function] |
14 |
| - (reify java.util.function.Consumer |
15 |
| - (accept [_ x] (function x)))) |
16 |
| - |
17 |
| -(defn fn->Runnable [function] |
| 11 | +(defn fn1->Runnable [function] |
18 | 12 | (reify java.lang.Runnable
|
19 | 13 | (run [_] (function nil))))
|
20 | 14 |
|
21 |
| -(defn fn->BiFunction [function] |
22 |
| - (reify java.util.function.BiFunction |
23 |
| - (apply [_ x y] (function x y)))) |
24 |
| - |
25 |
| -(defn fn->BiConsumer [function] |
26 |
| - (reify java.util.function.BiConsumer |
27 |
| - (accept [_ x y] (function x y)))) |
28 |
| - |
29 |
| -(defn fn->Runnable' [function] |
| 15 | +(defn fn2->Runnable [function] |
30 | 16 | (reify java.lang.Runnable
|
31 | 17 | (run [_] (function nil nil))))
|
32 | 18 |
|
|
71 | 57 | :with-executor
|
72 | 58 | (fn [^CompletionStage this operator executor]
|
73 | 59 | (.thenRunAsync this operator executor))}
|
74 |
| - :interface fn->Runnable |
| 60 | + :interface fn1->Runnable |
75 | 61 | :inner-assertion #(is (= % nil))
|
76 | 62 | :post-assertion #(is (= % nil))}])
|
77 | 63 |
|
|
162 | 148 | :with-executor
|
163 | 149 | (fn [^CompletionStage this other operator executor]
|
164 | 150 | (.runAfterBothAsync this other operator executor))}
|
165 |
| - :interface fn->Runnable' |
| 151 | + :interface fn2->Runnable |
166 | 152 | :inner-assertion (fn [_ _])
|
167 | 153 | :post-assertion (fn [_])}])
|
168 | 154 |
|
|
262 | 248 | :with-executor
|
263 | 249 | (fn [^CompletionStage this other operator executor]
|
264 | 250 | (.runAfterEitherAsync this other operator executor))}
|
265 |
| - :interface fn->Runnable |
| 251 | + :interface fn1->Runnable |
266 | 252 | :inner-assertion (fn [_])
|
267 | 253 | :post-assertion (fn [_])}])
|
268 | 254 |
|
|
0 commit comments