25 lines
452 B
Go
Raw Normal View History

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-12 22:13:13 +00:00
{"hello", "Hello", 0},
2024-07-15 14:51:36 +00:00
{"factorial", "", 120},
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)
})
}
}