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

parser/checker: if select { ... } { (#6434)

This commit is contained in:
Uwe Krüger
2020-09-21 07:34:04 +02:00
committed by GitHub
parent 27f91faae5
commit 0f1c484ad1
4 changed files with 12 additions and 3 deletions

View File

@ -91,7 +91,8 @@ fn test_select_blocks() {
ch1.close()
ch2.close()
mut h := 7
u := select {
mut is_open := true
if select {
b := <- ch2 {
h = 0
}
@ -101,11 +102,15 @@ fn test_select_blocks() {
else {
h = 2
}
} {
panic('channel is still open')
} else {
is_open = false
}
// no branch should have run
assert h == 7
// since all channels are closed `select` should return `false`
assert u == false
assert is_open == false
}