Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142package ast_test
import ( "path/filepath" "strings" "testing"
"git.urbach.dev/cli/q/src/ast" "git.urbach.dev/cli/q/src/compiler" "git.urbach.dev/cli/q/src/config" "git.urbach.dev/go/assert")
var errs = []struct { File string ExpectedError error}{ {"EmptySwitch.q", ast.EmptySwitch}, {"ExpectedBlock.q", ast.ExpectedBlock}, {"ExpectedIfBeforeElse.q", ast.ExpectedIfBeforeElse}, {"ExpectedIfBeforeElse2.q", ast.ExpectedIfBeforeElse}, {"InvalidInstruction.q", ast.InvalidInstruction}, {"InvalidInstruction2.q", ast.InvalidInstruction}, {"InvalidInstruction3.q", ast.InvalidInstruction}, {"InvalidInstruction4.q", ast.InvalidInstruction}, {"MissingOperand.q", ast.MissingOperand}, {"MissingOperand2.q", ast.MissingOperand}, {"NoElseIf.q", ast.NoElseIf},}
func TestErrors(t *testing.T) { for _, test := range errs { name := strings.TrimSuffix(test.File, ".q")
t.Run(name, func(t *testing.T) { b := config.New(filepath.Join("testdata", test.File)) _, err := compiler.Compile(b) assert.NotNil(t, err) assert.Equal(t, err.Error(), test.ExpectedError.Error()) }) }}