fspl/analyzer/analyzer_test.go

33 lines
543 B
Go

package analyzer
import "testing"
func TestFunctionUnique (test *testing.T) {
testStringErr (test,
"hello already declared at stream0.fspl:2:1", 3, 1,
`
[hello] = { }
[hello] = { }
`)
}
func TestTypeUnique (test *testing.T) {
testStringErr (test,
"hello already declared at stream0.fspl:2:1", 3, 1,
`
hello: *Int
hello: (x:Int y:Int)
`)
}
func TestMethodUnique (test *testing.T) {
testStringErr (test,
"Bird.fly already declared at stream0.fspl:3:1", 5, 1,
`
Bird: Int
Bird.[fly] = { }
Bird.[land] = { }
Bird.[fly distance:Int] = { }
`)
}