func cmd() {
app := &cli.App{
Commands: []*cli.Command{
{
Name: "create",
Usage: "create file",
Flags: []cli.Flag{
&cli.StringFlag{Name: "message, m"},
},
Action: func(c *cli.Context) error {
sample.SRCfile("hello/src") // function to create new file
return nil
},
},
},
},
},
}
func main() {
cmd()
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
my question is how to write unit test script for this function?
I have developed a cli
mycli createwill create a new file.Thanks