Added test case for enum section

This commit is contained in:
Sasha Koshka 2022-08-21 02:48:36 -04:00
parent 6fbda34300
commit c4f763af5b
3 changed files with 65 additions and 0 deletions

View File

@ -158,3 +158,37 @@ objt ro Init:Obj
`, test)
}
func TestEnum (test *testing.T) {
checkTree ("../tests/parser/enum",
`:arf
---
enum ro AffrontToGod:{Int 4}
bird0
28394
9328
398
9
bird1
23
932832
398
2349
bird2
1
2
3
4
enum ro NamedColor:U32
red 0xFF0000
green 0x00FF00
blue 0x0000FF
enum ro Weekday:Int
sunday
monday
tuesday
wednesday
thursday
friday
saturday
`, test)
}

View File

@ -200,5 +200,6 @@ type EnumSection struct {
what Type
permission types.Permission
// TODO: order matters here we need to store these in an array
members map[string] Argument
}

View File

@ -0,0 +1,30 @@
:arf
---
enum ro Weekday:Int
sunday
monday
tuesday
wednesday
thursday
friday
saturday
enum ro NamedColor:U32
red 0xFF0000
green 0x00FF00
blue 0x0000FF
enum ro AffrontToGod:{Int 4}
bird0
28394 9328
398 9
bird1
23 932832
398
2349
bird2
1
2
3
4