提交 7b220f4b 编写于 作者: chai2010's avatar chai2010

简化 std 测试方式

上级 b0839d7a
......@@ -23,19 +23,7 @@ ci-test-all:
go test ./...
@echo "== std test begin =="
go run main.go test binary
go run main.go test errors
go run main.go test fmt
go run main.go test image
go run main.go test image/bmp
go run main.go test image/color
go run main.go test io
go run main.go test math
go run main.go test os
go run main.go test regexp
go run main.go test strconv
go run main.go test unicode
go run main.go test unicode/utf8
go run main.go test std
@echo "== std ok =="
go run main.go ./waroot/hello.wa
......
......@@ -14,9 +14,20 @@ import (
"wa-lang.org/wa/internal/loader"
"wa-lang.org/wa/internal/wabt"
"wa-lang.org/wa/internal/wazero"
"wa-lang.org/wa/waroot"
)
func RunTest(cfg *config.Config, pkgpath string, appArgs ...string) {
var pkgList = []string{pkgpath}
if pkgpath == "std" {
pkgList = waroot.GetStdPkgList()
}
for _, p := range pkgList {
runTest(cfg, p, appArgs...)
}
}
func runTest(cfg *config.Config, pkgpath string, appArgs ...string) {
cfg.UnitTest = true
prog, err := loader.LoadProgram(cfg, pkgpath)
if err != nil {
......
......@@ -99,8 +99,11 @@ func IsStdPkg(pkgpath string) bool {
return false
}
func GetStdPkgList() []string {
return append([]string{}, stdPkgs...)
}
var stdPkgs = []string{
"arduino",
"binary",
"bytes",
"errors",
......@@ -121,7 +124,7 @@ var stdPkgs = []string{
"strconv",
"strings",
"syscall",
"text",
"text/template",
"unicode",
"unicode/utf8",
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册