Add some tests for the union type
This commit is contained in:
parent
e38ba2f4e2
commit
aacf1be026
@ -148,6 +148,29 @@ Bird: (.
|
||||
`)
|
||||
}
|
||||
|
||||
func TestTypeUnion (test *testing.T) {
|
||||
testString (test,
|
||||
`
|
||||
U: (| I8 I16 I32 I64 Int)
|
||||
Point: (. x:Int y:Int)
|
||||
Error: (~ [error]:String)
|
||||
PointOrError: (| Point Error)
|
||||
`)
|
||||
}
|
||||
|
||||
func TestTypeUnionAllowedUniqueErr (test *testing.T) {
|
||||
testStringErr (test,
|
||||
"(. x:Int) already listed in union at stream0.fspl:5:3", 7, 3,
|
||||
`
|
||||
U: (|
|
||||
U8
|
||||
U16
|
||||
(. x:Int)
|
||||
Int
|
||||
(. x:Int))
|
||||
`)
|
||||
}
|
||||
|
||||
func TestTypeInterfaceBehaviorUniqueErr (test *testing.T) {
|
||||
testStringErr (test,
|
||||
"fly already listed in interface at stream0.fspl:2:10", 2, 16,
|
||||
|
Loading…
Reference in New Issue
Block a user