kubo/core/commands/helptext_test.go
Steven Allen 2f17b951c2 gx: update deps
* Updates go-ipfs-cmds to try to get the tests to pass on travis.
* While we're at it, fix duplicate gx deps.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-02-19 13:12:21 -08:00

55 lines
1.1 KiB
Go

package commands
import (
"strings"
"testing"
cmds "gx/ipfs/QmQtQrtNioesAWtrx8csBvfY37gTe94d6wQ3VikZUjxD39/go-ipfs-cmds"
)
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
c.ProcessHelp()
t.Run(strings.Join(name, "_"), func(t *testing.T) {
if c.External {
t.Skip("external")
}
t.Run("tagline", func(t *testing.T) {
if c.Helptext.Tagline == "" {
t.Error("no Tagline!")
}
})
t.Run("longDescription", func(t *testing.T) {
t.Skip("not everywhere yet")
if c.Helptext.LongDescription == "" {
t.Error("no LongDescription!")
}
})
t.Run("shortDescription", func(t *testing.T) {
t.Skip("not everywhere yet")
if c.Helptext.ShortDescription == "" {
t.Error("no ShortDescription!")
}
})
t.Run("synopsis", func(t *testing.T) {
t.Skip("autogenerated in go-ipfs-cmds")
if c.Helptext.Synopsis == "" {
t.Error("no Synopsis!")
}
})
})
for subname, sub := range c.Subcommands {
checkHelptextRecursive(t, append(name, subname), sub)
}
}
func TestHelptexts(t *testing.T) {
Root.ProcessHelp()
checkHelptextRecursive(t, []string{"ipfs"}, Root)
}