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 180
180
(let [flag (alt-flag )
181
181
ports (vec ports) ; ; ensure vector for indexed nth
182
182
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))))
183
189
idxs (random-array n)
184
190
priority (:priority opts)
185
191
ret
Original file line number Diff line number Diff line change @@ -280,6 +280,12 @@ to catch and handle."
280
280
(let [flag (alt-flag )
281
281
ports (vec ports) ; ; ensure vector for indexed nth
282
282
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))))
283
289
^ints idxs (random-array n)
284
290
priority (:priority opts)
285
291
ret
Original file line number Diff line number Diff line change 465
465
:ok
466
466
(catch AssertionError e
467
467
: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