Liking cljdoc? Tell your friends :D
Clojure only.

me.pmatiello.mockfn.xtras


return-in-orderclj

(return-in-order & values)

Returns a function that, when called, returns the next value from values on each invocation, cycling through them.

If the next value is a function produced by

Example:

(providing
  [(one-fn :x) (return-in-order :a :b :c (invoke identity))]
  (is (= :a (one-fn :x)))
  (is (= :b (one-fn :x)))
  (is (= :c (one-fn :x)))
  (is (= :x (one-fn :x))))
Returns a function that, when called, returns the next value from `values`
on each invocation, cycling through them.

If the next value is a function produced by
- [[me.pmatiello.mockfn.plain/invoke]], or
- [[me.pmatiello.mockfn.clj-test/invoke]],
then the returned value will be the result of the invocation of this
function with the received call arguments.

Example:
```
(providing
  [(one-fn :x) (return-in-order :a :b :c (invoke identity))]
  (is (= :a (one-fn :x)))
  (is (= :b (one-fn :x)))
  (is (= :c (one-fn :x)))
  (is (= :x (one-fn :x))))
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close