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

命令行增加 test 子命令行入口, 还未实现

上级 cba0b0cc
......@@ -184,6 +184,26 @@ func (p *App) InitApp(name, pkgpath string, update bool) error {
return nil
}
func (p *App) RunTest(path string) error {
if path == "" {
path, _ = os.Getwd()
}
if strings.HasSuffix(path, "...") {
panic("TODO: test dir/...")
}
fi, err := os.Lstat(path)
if err != nil {
return err
}
if !fi.IsDir() {
panic("TODO: test path must be dir")
}
panic("todo")
}
func (p *App) Fmt(path string) error {
if path == "" {
path, _ = os.Getwd()
......
......@@ -341,7 +341,12 @@ func main() {
Name: "test",
Usage: "test packages",
Action: func(c *cli.Context) error {
fmt.Println("TODO")
waApp := app.NewApp(build_Options(c))
err := waApp.RunTest(c.Args().First())
if err != nil {
fmt.Println(err)
os.Exit(1)
}
return nil
},
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册