Skip to content

Commit bcd9d90

Browse files
committed
Move checkHelptextRecursive forward a bit
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
1 parent d06cf14 commit bcd9d90

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

core/commands/helptext_test.go

+35-16
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,48 @@ import (
88
)
99

1010
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
11-
if c.Helptext.Tagline == "" {
12-
t.Errorf("%s has no tagline!", strings.Join(name, " "))
13-
}
14-
15-
if c.Helptext.LongDescription == "" {
16-
t.Errorf("%s has no long description!", strings.Join(name, " "))
17-
}
18-
19-
if c.Helptext.ShortDescription == "" {
20-
t.Errorf("%s has no short description!", strings.Join(name, " "))
21-
}
22-
23-
if c.Helptext.Synopsis == "" {
24-
t.Errorf("%s has no synopsis!", strings.Join(name, " "))
25-
}
11+
c.ProcessHelp()
12+
13+
t.Run(strings.Join(name, "_"), func(t *testing.T) {
14+
if c.External {
15+
t.Skip("external")
16+
}
17+
18+
t.Run("tagline", func(t *testing.T) {
19+
if c.Helptext.Tagline == "" {
20+
t.Error("no Tagline!")
21+
}
22+
})
23+
24+
t.Run("longDescription", func(t *testing.T) {
25+
t.Skip("not everywhere yet")
26+
if c.Helptext.LongDescription == "" {
27+
t.Error("no LongDescription!")
28+
}
29+
})
30+
31+
t.Run("shortDescription", func(t *testing.T) {
32+
t.Skip("not everywhere yet")
33+
if c.Helptext.ShortDescription == "" {
34+
t.Error("no ShortDescription!")
35+
}
36+
})
37+
38+
t.Run("synopsis", func(t *testing.T) {
39+
t.Skip("autogenerated in go-ipfs-cmds")
40+
if c.Helptext.Synopsis == "" {
41+
t.Error("no Synopsis!")
42+
}
43+
})
44+
})
2645

2746
for subname, sub := range c.Subcommands {
2847
checkHelptextRecursive(t, append(name, subname), sub)
2948
}
3049
}
3150

3251
func TestHelptexts(t *testing.T) {
33-
t.Skip("sill isn't 100%")
52+
//t.Skip("sill isn't 100%")
3453
Root.ProcessHelp()
3554
checkHelptextRecursive(t, []string{"ipfs"}, Root)
3655
}

core/commands/urlstore.go

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import (
2020
)
2121

2222
var urlStoreCmd = &cmds.Command{
23+
Helptext: cmdkit.HelpText{
24+
Tagline: "Interact with urlstore.",
25+
},
2326
Subcommands: map[string]*cmds.Command{
2427
"add": urlAdd,
2528
},

0 commit comments

Comments
 (0)