Skip to content

Commit

Permalink
fix latest-concat protocol violation
Browse files Browse the repository at this point in the history
  • Loading branch information
leonoel authored and dustingetz committed Sep 11, 2024
1 parent a3c9951 commit 03eab83
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/hyperfiddle/incseq/latest_concat_impl.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
(do (aset state slot-pending true)
(unlock state held) (step))
(if (zero? (aget state slot-alive))
(do (unlock state held) (done))
(do (aset state slot-pending true)
(unlock state held) (done))
(unlock state held))))))

(defn outer-ready [^objects state]
Expand Down
39 changes: 38 additions & 1 deletion test/hyperfiddle/incseq/latest_concat_impl_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,41 @@
(is (= (q) :cancel0))
(q false)
(step0)
(is (q) :done))))
(is (q) :done))))

(deftest cancel-after-termination
(let [q (queue)
ps ((flow (fn [step done]
(step)
(->Ps #(q :cancel)
(fn []
(done)
{:grow 1
:degree 1
:shrink 0
:permutation {}
:change {0 (fn [step done]
(step)
(->Ps #(q :cancel0)
(fn []
(done)
{:grow 1
:degree 1
:shrink 0
:permutation {}
:change {0 :foo}
:freeze #{0}})))}
:freeze #{0}}))))
#(q :step) #(q :done))]
(is (= (q) :step))
(is (= @ps {:grow 1
:degree 1
:shrink 0
:permutation {}
:change {0 :foo}
:freeze #{0}}))
(is (= (q) :done))
(ps)
(is (= :cancel (q)))
(is (= :cancel0 (q)))
(is (= (doto :over q) (q)))))

0 comments on commit 03eab83

Please sign in to comment.