File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
test/clojure/clojure/core Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 180180 (let [flag (alt-flag )
181181 ports (vec ports) ; ; ensure vector for indexed nth
182182 n (count ports)
183+ _ (loop [i 0 ] ; ; check for invalid write op
184+ (when (< i n)
185+ (let [port (nth ports i)]
186+ (when (vector? port)
187+ (assert (some? (port 1 )) " can't put nil on channel" )))
188+ (recur (unchecked-inc i))))
183189 idxs (random-array n)
184190 priority (:priority opts)
185191 ret
Original file line number Diff line number Diff line change @@ -280,6 +280,12 @@ to catch and handle."
280280 (let [flag (alt-flag )
281281 ports (vec ports) ; ; ensure vector for indexed nth
282282 n (count ports)
283+ _ (loop [i 0 ] ; ; check for invalid write op
284+ (when (< i n)
285+ (let [port (nth ports i)]
286+ (when (vector? port)
287+ (assert (some? (port 1 )) " can't put nil on channel" )))
288+ (recur (unchecked-inc i))))
283289 ^ints idxs (random-array n)
284290 priority (:priority opts)
285291 ret
Original file line number Diff line number Diff line change 465465 :ok
466466 (catch AssertionError e
467467 :ko ))))))
468+
469+ (deftest test-alts-put-nil-invalid
470+ (is
471+ (thrown? AssertionError
472+ (let [c1 (a/chan )
473+ c2 (a/chan )]
474+ (a/alts!! [c1 [c2 nil ]])))))
You can’t perform that action at this time.
0 commit comments