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

cgen: fix enum in map (#9912)

This commit is contained in:
ka-weihe
2021-04-28 21:11:32 +02:00
committed by GitHub
parent a065d014a2
commit 6795b02e24
2 changed files with 11 additions and 2 deletions

View File

@ -617,6 +617,15 @@ type ColorAlias = Color
fn test_alias_enum() {
mut m := map[ColorAlias]string{}
m[Color.red] = 'hi'
assert m[Color.red] == 'hi'
}
fn test_enum_in_map() {
mut m := map[Color]string{}
m[Color.red] = 'hi'
assert Color.red in m
assert Color.green !in m
assert Color.blue !in m
}
fn test_voidptr_keys() {