Skip to content

Commit

Permalink
[i/items] failure on reentrant transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurC committed Aug 28, 2024
1 parent d940f00 commit 1b3091c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/hyperfiddle/incseq/items_eager_impl_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,24 @@
_ (q ::none)
_ (t/is (= ::none (q)))]))

(t/deftest failure-on-reentrant-transfer
(let [q (->mq)
<transfer-fn> (->box (let [<first?> (->box true)]
(fn [step done]
(if (<first?>)
(do (<first?> false) (step) (d/empty-diff 0))
(do (done) (throw (ex-info "boom" {})))))))
items (spawn-ps q <transfer-fn>)
[_in-step _in-done] (q)
_ (t/is (= :input-cancel (q)))
_ (t/is (= :items-step (q)))
_ (t/is (thrown? ExceptionInfo @items))
_ (t/is (= :items-done (q)))
_ (q ::none)
_ (t/is (= ::none (q)))]))

;; missing tests
;; - failures
;; - reentrant transfer
;; - after cancellation
;; - item* grow
;; - double cancel before termination
Expand Down

0 comments on commit 1b3091c

Please sign in to comment.