Added more tests
This commit is contained in:
@ -10,34 +10,34 @@ import (
|
||||
"git.akyoto.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestErrors(t *testing.T) {
|
||||
tests := []struct {
|
||||
File string
|
||||
ExpectedError error
|
||||
}{
|
||||
{"ExpectedFunctionDefinition.q", errors.ExpectedFunctionDefinition},
|
||||
{"ExpectedFunctionName.q", errors.ExpectedFunctionName},
|
||||
{"ExpectedFunctionParameters.q", errors.ExpectedFunctionParameters},
|
||||
{"InvalidInstructionIdentifier.q", &errors.InvalidInstruction{Instruction: "abc"}},
|
||||
{"InvalidInstructionNumber.q", &errors.InvalidInstruction{Instruction: "123"}},
|
||||
{"InvalidExpression.q", errors.InvalidExpression},
|
||||
{"InvalidOperator.q", &errors.InvalidOperator{Operator: "+++"}},
|
||||
{"InvalidCharacter.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"InvalidCharacter2.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"InvalidCharacter3.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"MissingAssignValue.q", errors.MissingAssignValue},
|
||||
{"MissingBlockEnd.q", errors.MissingBlockEnd},
|
||||
{"MissingBlockStart.q", errors.MissingBlockStart},
|
||||
{"MissingGroupEnd.q", errors.MissingGroupEnd},
|
||||
{"MissingGroupStart.q", errors.MissingGroupStart},
|
||||
{"MissingMainFunction.q", errors.MissingMainFunction},
|
||||
{"VariableAlreadyExists.q", &errors.VariableAlreadyExists{Name: "x"}},
|
||||
{"UnknownIdentifier.q", &errors.UnknownIdentifier{Name: "x"}},
|
||||
{"UnknownIdentifier2.q", &errors.UnknownIdentifier{Name: "x"}},
|
||||
{"UnusedVariable.q", &errors.UnusedVariable{Name: "x"}},
|
||||
}
|
||||
var errs = []struct {
|
||||
File string
|
||||
ExpectedError error
|
||||
}{
|
||||
{"ExpectedFunctionDefinition.q", errors.ExpectedFunctionDefinition},
|
||||
{"ExpectedFunctionName.q", errors.ExpectedFunctionName},
|
||||
{"ExpectedFunctionParameters.q", errors.ExpectedFunctionParameters},
|
||||
{"InvalidInstructionIdentifier.q", &errors.InvalidInstruction{Instruction: "abc"}},
|
||||
{"InvalidInstructionNumber.q", &errors.InvalidInstruction{Instruction: "123"}},
|
||||
{"InvalidExpression.q", errors.InvalidExpression},
|
||||
{"InvalidOperator.q", &errors.InvalidOperator{Operator: "+++"}},
|
||||
{"InvalidCharacter.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"InvalidCharacter2.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"InvalidCharacter3.q", &errors.InvalidCharacter{Character: "@"}},
|
||||
{"MissingAssignValue.q", errors.MissingAssignValue},
|
||||
{"MissingBlockEnd.q", errors.MissingBlockEnd},
|
||||
{"MissingBlockStart.q", errors.MissingBlockStart},
|
||||
{"MissingGroupEnd.q", errors.MissingGroupEnd},
|
||||
{"MissingGroupStart.q", errors.MissingGroupStart},
|
||||
{"MissingMainFunction.q", errors.MissingMainFunction},
|
||||
{"VariableAlreadyExists.q", &errors.VariableAlreadyExists{Name: "x"}},
|
||||
{"UnknownIdentifier.q", &errors.UnknownIdentifier{Name: "x"}},
|
||||
{"UnknownIdentifier2.q", &errors.UnknownIdentifier{Name: "x"}},
|
||||
{"UnusedVariable.q", &errors.UnusedVariable{Name: "x"}},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
func TestErrors(t *testing.T) {
|
||||
for _, test := range errs {
|
||||
name := strings.TrimSuffix(test.File, ".q")
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user