blacklist certain tests
This commit is contained in:
@@ -8,10 +8,16 @@ import (
|
||||
"monkey/parser"
|
||||
"monkey/utils"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var BlacklistedExamples = map[string]bool{
|
||||
"echoserver": true,
|
||||
}
|
||||
|
||||
func assertEvaluated(t *testing.T, expected interface{}, actual object.Object) {
|
||||
t.Helper()
|
||||
|
||||
@@ -884,17 +890,26 @@ func TestImportSearchPaths(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExamples(t *testing.T) {
|
||||
matches, err := filepath.Glob("../examples/*.monkey")
|
||||
matches, err := filepath.Glob("./examples/*.monkey")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
for _, match := range matches {
|
||||
b, err := os.ReadFile(match)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
basename := path.Base(match)
|
||||
name := strings.TrimSuffix(basename, filepath.Ext(basename))
|
||||
|
||||
if BlacklistedExamples[name] {
|
||||
t.Skipf("not testing blacklisted example %s", name)
|
||||
}
|
||||
testEval(string(b))
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
b, err := os.ReadFile(match)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testEval(string(b))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user