From 28111454371fe17adf64e0268b8ebf402946832a Mon Sep 17 00:00:00 2001 From: d2verb Date: Sat, 13 Jul 2019 15:45:40 +0900 Subject: [PATCH] Add enum_test.v --- compiler/tests/enum_test.v | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 compiler/tests/enum_test.v diff --git a/compiler/tests/enum_test.v b/compiler/tests/enum_test.v new file mode 100644 index 0000000000..f5b746baa4 --- /dev/null +++ b/compiler/tests/enum_test.v @@ -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 +}