mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 03:17:43 +08:00
Merge pull request #5889 from ipfs/feat/better-helptext-test
Move checkHelptextRecursive forward a bit
This commit is contained in:
commit
776bead2c2
@ -8,21 +8,40 @@ import (
|
||||
)
|
||||
|
||||
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
|
||||
if c.Helptext.Tagline == "" {
|
||||
t.Errorf("%s has no tagline!", strings.Join(name, " "))
|
||||
}
|
||||
c.ProcessHelp()
|
||||
|
||||
if c.Helptext.LongDescription == "" {
|
||||
t.Errorf("%s has no long description!", strings.Join(name, " "))
|
||||
}
|
||||
t.Run(strings.Join(name, "_"), func(t *testing.T) {
|
||||
if c.External {
|
||||
t.Skip("external")
|
||||
}
|
||||
|
||||
if c.Helptext.ShortDescription == "" {
|
||||
t.Errorf("%s has no short description!", strings.Join(name, " "))
|
||||
}
|
||||
t.Run("tagline", func(t *testing.T) {
|
||||
if c.Helptext.Tagline == "" {
|
||||
t.Error("no Tagline!")
|
||||
}
|
||||
})
|
||||
|
||||
if c.Helptext.Synopsis == "" {
|
||||
t.Errorf("%s has no synopsis!", strings.Join(name, " "))
|
||||
}
|
||||
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)
|
||||
@ -30,7 +49,6 @@ func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
|
||||
}
|
||||
|
||||
func TestHelptexts(t *testing.T) {
|
||||
t.Skip("sill isn't 100%")
|
||||
Root.ProcessHelp()
|
||||
checkHelptextRecursive(t, []string{"ipfs"}, Root)
|
||||
}
|
||||
|
||||
@ -20,6 +20,9 @@ import (
|
||||
)
|
||||
|
||||
var urlStoreCmd = &cmds.Command{
|
||||
Helptext: cmdkit.HelpText{
|
||||
Tagline: "Interact with urlstore.",
|
||||
},
|
||||
Subcommands: map[string]*cmds.Command{
|
||||
"add": urlAdd,
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user