-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to enforce helptext on commands
Add ProcessHelp call to Helptext test. License: MIT Signed-off-by: Jeromy <why@ipfs.io> License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
- Loading branch information
1 parent
06a6e2f
commit 5ce2bfb
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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) { | ||
Root.ProcessHelp() | ||
checkHelptextRecursive(t, []string{"ipfs"}, Root) | ||
} |