mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Add enum_test.v
This commit is contained in:
parent
298ca8676f
commit
2811145437
24
compiler/tests/enum_test.v
Normal file
24
compiler/tests/enum_test.v
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
enum Color {
|
||||||
|
red
|
||||||
|
blue
|
||||||
|
green
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_enum() {
|
||||||
|
assert Color.red == Color.red
|
||||||
|
assert Color.blue == Color.blue
|
||||||
|
assert Color.green == Color.green
|
||||||
|
|
||||||
|
assert Color.red == .red
|
||||||
|
assert Color.blue == .blue
|
||||||
|
assert Color.green == .green
|
||||||
|
|
||||||
|
assert Color.red != Color.blue
|
||||||
|
assert Color.red != Color.green
|
||||||
|
assert Color.blue != Color.green
|
||||||
|
|
||||||
|
mut color := Color.red
|
||||||
|
assert color == Color.red
|
||||||
|
color = .green
|
||||||
|
assert color == Color.green
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user