move out c/cpp/py
This commit is contained in:
33
cmd/internal/test/test.go
Normal file
33
cmd/internal/test/test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/goplus/llgo/cmd/internal/base"
|
||||
"github.com/goplus/llgo/internal/build"
|
||||
)
|
||||
|
||||
// llgo test
|
||||
var Cmd = &base.Command{
|
||||
UsageLine: "llgo test [build flags] package [arguments...]",
|
||||
Short: "Compile and run Go test",
|
||||
}
|
||||
|
||||
func init() {
|
||||
Cmd.Run = runCmd
|
||||
}
|
||||
|
||||
func runCmd(cmd *base.Command, args []string) {
|
||||
runCmdEx(cmd, args, build.ModeRun)
|
||||
}
|
||||
|
||||
func runCmdEx(_ *base.Command, args []string, mode build.Mode) {
|
||||
conf := build.NewDefaultConf(mode)
|
||||
conf.Mode = build.ModeTest
|
||||
_, err := build.Do(args, conf)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user