Added test case for enum section
This commit is contained in:
parent
6fbda34300
commit
c4f763af5b
@ -158,3 +158,37 @@ objt ro Init:Obj
|
|||||||
`, test)
|
`, 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)
|
||||||
|
}
|
||||||
|
@ -200,5 +200,6 @@ type EnumSection struct {
|
|||||||
|
|
||||||
what Type
|
what Type
|
||||||
permission types.Permission
|
permission types.Permission
|
||||||
|
// TODO: order matters here we need to store these in an array
|
||||||
members map[string] Argument
|
members map[string] Argument
|
||||||
}
|
}
|
||||||
|
30
tests/parser/enum/main.arf
Normal file
30
tests/parser/enum/main.arf
Normal 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
|
Reference in New Issue
Block a user