Files
llgo/cmd/internal/test/test.go
2025-04-03 16:26:11 +08:00

34 lines
616 B
Go

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)
}
}