Skip to content

Commit

Permalink
Merge pull request #2648 from ipfs/feat/helptext-test
Browse files Browse the repository at this point in the history
add test to enforce helptext on commands
  • Loading branch information
whyrusleeping committed Mar 24, 2017
2 parents 8eeb693 + 43949ef commit 7b2d9ad
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions core/commands/helptext_test.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 7b2d9ad

Please sign in to comment.