Updated analyzer tests to account for lexer changes
This commit is contained in:
parent
c375c18922
commit
87dcc18a8d
@ -201,7 +201,7 @@ testString (test,
|
|||||||
Bird: ([fly distance:F64] [land])
|
Bird: ([fly distance:F64] [land])
|
||||||
BlueJay: Int
|
BlueJay: Int
|
||||||
BlueJay::[fly distance:F64] = { }
|
BlueJay::[fly distance:F64] = { }
|
||||||
BlueJay::[fly land] = { }
|
BlueJay::[land] = { }
|
||||||
[main] = {
|
[main] = {
|
||||||
a:BlueJay
|
a:BlueJay
|
||||||
b:Bird = [@a]
|
b:Bird = [@a]
|
||||||
@ -224,7 +224,8 @@ B:([g]:Int)
|
|||||||
d:Int = { a:F64 b }
|
d:Int = { a:F64 b }
|
||||||
e:Byte = [f]
|
e:Byte = [f]
|
||||||
g:(x:Int y:(w:F64 z:F64)) = (x: 1 y: (w: 1.2 z: 78.5))
|
g:(x:Int y:(w:F64 z:F64)) = (x: 1 y: (w: 1.2 z: 78.5))
|
||||||
h:F64 = g.x.z
|
gx:(w:F64 z:F64) = g.x
|
||||||
|
h:F64 = gx.z
|
||||||
i:A
|
i:A
|
||||||
j:Int = [i::g]
|
j:Int = [i::g]
|
||||||
k:B = i
|
k:B = i
|
||||||
|
@ -6,7 +6,7 @@ func TestCastErrIntPointer (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from *Int to Int", 2, 14,
|
"cannot convert from *Int to Int", 2, 14,
|
||||||
`
|
`
|
||||||
[main]:Int = [~ [@ a:Int] Int]
|
[main]:Int = [~ Int [@ a:Int]]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ func TestCastErrIntStruct (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from (x:Int y:Int) to Int", 2, 14,
|
"cannot convert from (x:Int y:Int) to Int", 2, 14,
|
||||||
`
|
`
|
||||||
[main]:Int = [~ a:(x:Int y:Int) Int]
|
[main]:Int = [~ Int a:(x:Int y:Int)]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ func TestCastErrIntArray (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from 5:Int to Int", 2, 14,
|
"cannot convert from 5:Int to Int", 2, 14,
|
||||||
`
|
`
|
||||||
[main]:Int = [~ a:5:Int Int]
|
[main]:Int = [~ Int a:5:Int]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ func TestCastErrIntSlice (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from *:Int to Int", 2, 14,
|
"cannot convert from *:Int to Int", 2, 14,
|
||||||
`
|
`
|
||||||
[main]:Int = [~ a:*:Int Int]
|
[main]:Int = [~ Int a:*:Int]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ func TestCastErrPointerInt (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from Int to *Int", 2, 15,
|
"cannot convert from Int to *Int", 2, 15,
|
||||||
`
|
`
|
||||||
[main]:*Int = [~ [@ a:Int] *Int]
|
[main]:*Int = [~ *Int [@ a:Int]]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ func TestCastErrStructInt (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from Int to (x:Int y:Int)", 2, 24,
|
"cannot convert from Int to (x:Int y:Int)", 2, 24,
|
||||||
`
|
`
|
||||||
[main]:(x:Int y:Int) = [~ a:Int (x:Int y:Int)]
|
[main]:(x:Int y:Int) = [~ (x:Int y:Int) a:Int]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ func TestCastErrArrayInt (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from Int to 5:Int", 2, 13,
|
"cannot convert from Int to 5:Int", 2, 13,
|
||||||
`
|
`
|
||||||
[main]:Int = [~ a:5:Int Int]
|
[main]:Int = [~ Int a:5:Int]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ func TestCastErrSliceInt (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot convert from Int to *:Int", 2, 16,
|
"cannot convert from Int to *:Int", 2, 16,
|
||||||
`
|
`
|
||||||
[main]:*:Int = [~ a:Int *:Int]
|
[main]:*:Int = [~ *:Int a:Int]
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,16 +72,16 @@ testString (test,
|
|||||||
Bird: ([fly distance:F64] [land])
|
Bird: ([fly distance:F64] [land])
|
||||||
BlueJay: Int
|
BlueJay: Int
|
||||||
BlueJay::[fly distance:F64] = { }
|
BlueJay::[fly distance:F64] = { }
|
||||||
BlueJay::[fly land] = { }
|
BlueJay::[land] = { }
|
||||||
IntDerived: Int
|
IntDerived: Int
|
||||||
[main] = {
|
[main] = {
|
||||||
a:IntDerived = 5
|
a:IntDerived = 5
|
||||||
b:Int [~ [~ [~ a Byte] F64] Int]
|
b:Int [~ Int [~ F64 [~ Byte a]]]
|
||||||
c:Int [~~ [~~ [~~ a Byte] F64] Int]
|
c:Int [~~ Int [~~ F64 [~~ Byte a]]]
|
||||||
d:(x:Int y:Int) = (x: 1 y: 2)
|
d:(x:Int y:Int) = (x: 1 y: 2)
|
||||||
e:(z:Int a:Int) = [~~ d (z:Int a:Int)]
|
e:(z:Int a:Int) = [~~ (z:Int a:Int) d]
|
||||||
f:Bird = [@ [~~ 0 BlueJay]]
|
f:Bird = [@ [~~ BlueJay 0]]
|
||||||
g:*:Int = (~ h:5:Int *:int)
|
g:*:Int = [~ *:Int h:5:Int]
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@ testStringErr (test,
|
|||||||
"hello already declared at stream0.fspl:2:1", 3, 1,
|
"hello already declared at stream0.fspl:2:1", 3, 1,
|
||||||
`
|
`
|
||||||
[hello] = { }
|
[hello] = { }
|
||||||
[world] = { }
|
[hello] = { }
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFunctionUnique (test *testing.T) {
|
func TestFunctionUnique (test *testing.T) {
|
||||||
testString (test,
|
testString (test,
|
||||||
`
|
`
|
||||||
hello: *Int
|
[hello] = { }
|
||||||
[world] = { }
|
[world] = { }
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
@ -39,20 +39,10 @@ testStringErr (test,
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVariableUniqueErrShadowBuiltin (test *testing.T) {
|
|
||||||
testStringErr (test,
|
|
||||||
"cannot shadow builtin false ", 3, 2,
|
|
||||||
`
|
|
||||||
[main] = {
|
|
||||||
false:Bool = true
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVariableUnique (test *testing.T) {
|
func TestVariableUnique (test *testing.T) {
|
||||||
testString (test,
|
testString (test,
|
||||||
`
|
`
|
||||||
x: Int
|
[x] = { }
|
||||||
[y] = { }
|
[y] = { }
|
||||||
[main x:Int] = {
|
[main x:Int] = {
|
||||||
x:Int
|
x:Int
|
||||||
@ -66,17 +56,6 @@ x: Int
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVariableNameErrType (test *testing.T) {
|
|
||||||
testStringErr (test,
|
|
||||||
"named type example cannot be used as location expression", 4, 2,
|
|
||||||
`
|
|
||||||
example: Int
|
|
||||||
[main] = {
|
|
||||||
example = 5
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVariableNameErrFunction (test *testing.T) {
|
func TestVariableNameErrFunction (test *testing.T) {
|
||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"function example cannot be used as location expression", 4, 2,
|
"function example cannot be used as location expression", 4, 2,
|
||||||
@ -131,15 +110,6 @@ testString (test,
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFunctionNameErrType (test *testing.T) {
|
|
||||||
testStringErr (test,
|
|
||||||
"cannot call named type example", 3, 3,
|
|
||||||
`
|
|
||||||
example: Int
|
|
||||||
[main] = [example]
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFunctionNameErrVar (test *testing.T) {
|
func TestFunctionNameErrVar (test *testing.T) {
|
||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"cannot call example:Int", 4, 3,
|
"cannot call example:Int", 4, 3,
|
||||||
|
@ -4,18 +4,10 @@ import "testing"
|
|||||||
|
|
||||||
func TestTypedefUniqueErr (test *testing.T) {
|
func TestTypedefUniqueErr (test *testing.T) {
|
||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"hello already declared at stream0.fspl:2:1", 3, 1,
|
"Hello already declared at stream0.fspl:2:1", 3, 1,
|
||||||
`
|
`
|
||||||
hello: *Int
|
Hello: *Int
|
||||||
hello: (x:Int y:Int)
|
Hello: (x:Int y:Int)
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTypedefUniqueErrShadowReservedConst (test *testing.T) {
|
|
||||||
testStringErr (test,
|
|
||||||
"cannot shadow builtin true", 2, 1,
|
|
||||||
`
|
|
||||||
true: Int
|
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,8 +30,8 @@ String: Int
|
|||||||
func TestTypedefUnique (test *testing.T) {
|
func TestTypedefUnique (test *testing.T) {
|
||||||
testString (test,
|
testString (test,
|
||||||
`
|
`
|
||||||
hello: *Int
|
Hello: *Int
|
||||||
world: (x:Int y:Int)
|
World: (x:Int y:Int)
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +58,7 @@ func TestTypeNamedErrMissing (test *testing.T) {
|
|||||||
testStringErr (test,
|
testStringErr (test,
|
||||||
"no type named Missing", 2, 10,
|
"no type named Missing", 2, 10,
|
||||||
`
|
`
|
||||||
present: Missing
|
Present: Missing
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user