2024-07-03 09:39:24 +00:00
|
|
|
package tests_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2024-07-03 09:59:36 +00:00
|
|
|
var examples = []struct {
|
|
|
|
Name string
|
|
|
|
ExpectedOutput string
|
|
|
|
ExpectedExitCode int
|
|
|
|
}{
|
2024-07-07 10:30:57 +00:00
|
|
|
{"hello", "", 0},
|
2024-07-09 08:28:14 +00:00
|
|
|
{"fibonacci", "", 55},
|
2024-07-03 09:59:36 +00:00
|
|
|
}
|
2024-07-03 09:39:24 +00:00
|
|
|
|
2024-07-03 09:59:36 +00:00
|
|
|
func TestExamples(t *testing.T) {
|
|
|
|
for _, test := range examples {
|
2024-07-03 09:39:24 +00:00
|
|
|
t.Run(test.Name, func(t *testing.T) {
|
|
|
|
run(t, filepath.Join("..", "examples", test.Name), test.ExpectedOutput, test.ExpectedExitCode)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|