mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 04:47:45 +08:00
Merge pull request #2648 from ipfs/feat/helptext-test
add test to enforce helptext on commands
This commit is contained in:
commit
7b2d9adcfa
36
core/commands/helptext_test.go
Normal file
36
core/commands/helptext_test.go
Normal file
@ -0,0 +1,36 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
cmds "github.com/ipfs/go-ipfs/commands"
|
||||
)
|
||||
|
||||
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
|
||||
if c.Helptext.Tagline == "" {
|
||||
t.Errorf("%s has no tagline!", strings.Join(name, " "))
|
||||
}
|
||||
|
||||
if c.Helptext.LongDescription == "" {
|
||||
t.Errorf("%s has no long description!", strings.Join(name, " "))
|
||||
}
|
||||
|
||||
if c.Helptext.ShortDescription == "" {
|
||||
t.Errorf("%s has no short description!", strings.Join(name, " "))
|
||||
}
|
||||
|
||||
if c.Helptext.Synopsis == "" {
|
||||
t.Errorf("%s has no synopsis!", strings.Join(name, " "))
|
||||
}
|
||||
|
||||
for subname, sub := range c.Subcommands {
|
||||
checkHelptextRecursive(t, append(name, subname), sub)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHelptexts(t *testing.T) {
|
||||
t.Skip("sill isn't 100%")
|
||||
Root.ProcessHelp()
|
||||
checkHelptextRecursive(t, []string{"ipfs"}, Root)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user