33 lines
No EOL
626 B
Go
33 lines
No EOL
626 B
Go
package tests_test
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"git.urbach.dev/cli/q/src/build"
|
|
"git.urbach.dev/cli/q/src/compiler"
|
|
"git.urbach.dev/go/assert"
|
|
)
|
|
|
|
var examples = []testRun{
|
|
{"hello", "", "Hello\n", 0},
|
|
}
|
|
|
|
func TestExamples(t *testing.T) {
|
|
for _, test := range examples {
|
|
test.Run(t, filepath.Join("..", "examples", test.Name))
|
|
}
|
|
}
|
|
|
|
func BenchmarkExamples(b *testing.B) {
|
|
for _, test := range examples {
|
|
b.Run(test.Name, func(b *testing.B) {
|
|
example := build.New(filepath.Join("..", "examples", test.Name))
|
|
|
|
for b.Loop() {
|
|
_, err := compiler.Compile(example)
|
|
assert.Nil(b, err)
|
|
}
|
|
})
|
|
}
|
|
} |