1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/sync/channel_try_unbuf_test.v

14 lines
268 B
V
Raw Normal View History

fn test_channel_try_unbuffered() {
ch := chan int{}
for z in 5 .. 8 {
if ch.try_push(z) == .not_ready {
assert z == 5
break
}
panic('push on non-ready channel not detected')
}
mut obj := -17
for ch.try_pop(mut obj) == .success {}
assert obj == -17
}