Skip to content

Commit

Permalink
add test to enforce helptext on commands
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
  • Loading branch information
whyrusleeping committed May 10, 2016
1 parent 1a6f8c6 commit e5cad57
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions core/commands/helptext_test.go
@@ -0,0 +1,33 @@
package commands

import (
cmds "github.com/ipfs/go-ipfs/commands"
"strings"
"testing"
)

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) {
checkHelptextRecursive(t, []string{"ipfs"}, Root)
}

0 comments on commit e5cad57

Please sign in to comment.