q/tests/examples_test.go
Eduard Urbach 7a294061d6
All checks were successful
/ test (push) Successful in 15s
Added more tests
2025-07-05 12:14:34 +02:00

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)
}
})
}
}