Add union assignment tests to analyzer
This commit is contained in:
parent
98d8edc319
commit
41116e0b13
|
@ -249,6 +249,40 @@ BlueJay.[land] = { }
|
|||
`)
|
||||
}
|
||||
|
||||
func TestAssignmentUnion (test *testing.T) {
|
||||
testString (test,
|
||||
`
|
||||
U: (| Int F64)
|
||||
[main] = {
|
||||
x:F64 = 7.7
|
||||
y:U = x
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestAssignmentUnionToUnion (test *testing.T) {
|
||||
testString (test,
|
||||
`
|
||||
U: (| Int F64)
|
||||
[main] = {
|
||||
x:U y:U
|
||||
x = y
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestAssignmentUnionErrNotListed (test *testing.T) {
|
||||
testStringErr (test,
|
||||
"I64 is not included within union (| Int F64)", 5, 8,
|
||||
`
|
||||
U: (| Int F64)
|
||||
[main] = {
|
||||
x:I64 = 7
|
||||
y:U = x
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestAssignmentErrByteSliceString (test *testing.T) {
|
||||
testStringErr (test,
|
||||
"expected *:Byte", 4, 13,
|
||||
|
|
Loading…
Reference in New Issue