aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/sync/channel_try_unbuf_test.v
blob: ee11468a6525b2fded06182715c68920cd3c3046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}