mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: replace the switch statement in parse()
This commit is contained in:
@ -29,3 +29,14 @@ fn test_in() {
|
||||
assert color in [.red, .green]
|
||||
assert num == 3
|
||||
}
|
||||
|
||||
fn test_match() {
|
||||
color := Color.red
|
||||
num := 3
|
||||
match color {
|
||||
.red { assert true }
|
||||
.green { assert false }
|
||||
else { assert false }
|
||||
}
|
||||
assert num == 3
|
||||
}
|
||||
|
Reference in New Issue
Block a user