Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move checkHelptextRecursive forward a bit #5889

Merged
merged 1 commit into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions core/commands/helptext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,47 @@ import (
)

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, " "))
}
c.ProcessHelp()

t.Run(strings.Join(name, "_"), func(t *testing.T) {
if c.External {
t.Skip("external")
}

t.Run("tagline", func(t *testing.T) {
if c.Helptext.Tagline == "" {
t.Error("no Tagline!")
}
})

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)
}
}

func TestHelptexts(t *testing.T) {
t.Skip("sill isn't 100%")
Root.ProcessHelp()
checkHelptextRecursive(t, []string{"ipfs"}, Root)
}
3 changes: 3 additions & 0 deletions core/commands/urlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (
)

var urlStoreCmd = &cmds.Command{
Helptext: cmdkit.HelpText{
Tagline: "Interact with urlstore.",
},
Subcommands: map[string]*cmds.Command{
"add": urlAdd,
},
Expand Down