mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
feat: #1140 updating test values to match with callback name
This commit is contained in:
parent
0856a41798
commit
b522459430
1 changed files with 4 additions and 4 deletions
|
@ -133,7 +133,7 @@ func TestGenMdTreeCustomWithFooter(t *testing.T) {
|
||||||
defer os.RemoveAll(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
prepender := func(s string) string { return "Prepended" }
|
prepender := func(s string) string { return "Prepended" }
|
||||||
appender := func(s string) string { return "Postpended" }
|
appender := func(s string) string { return "Appended" }
|
||||||
identity := func(s string) string { return s }
|
identity := func(s string) string { return s }
|
||||||
|
|
||||||
if err := GenMarkdownTreeCustomWithFooter(rootCmd, tmpdir, prepender, appender, identity); err != nil {
|
if err := GenMarkdownTreeCustomWithFooter(rootCmd, tmpdir, prepender, appender, identity); err != nil {
|
||||||
|
@ -143,17 +143,17 @@ func TestGenMdTreeCustomWithFooter(t *testing.T) {
|
||||||
gotRoot := fileContents(t, tmpdir, "root.md")
|
gotRoot := fileContents(t, tmpdir, "root.md")
|
||||||
checkStringContains(t, gotRoot, "Prepended")
|
checkStringContains(t, gotRoot, "Prepended")
|
||||||
checkStringContains(t, gotRoot, rootCmd.Long)
|
checkStringContains(t, gotRoot, rootCmd.Long)
|
||||||
checkStringContains(t, gotRoot, "Postpended")
|
checkStringContains(t, gotRoot, "Appended")
|
||||||
|
|
||||||
gotEcho := fileContents(t, tmpdir, "root_echo.md")
|
gotEcho := fileContents(t, tmpdir, "root_echo.md")
|
||||||
checkStringContains(t, gotEcho, "Prepended")
|
checkStringContains(t, gotEcho, "Prepended")
|
||||||
checkStringContains(t, gotEcho, echoCmd.Long)
|
checkStringContains(t, gotEcho, echoCmd.Long)
|
||||||
checkStringContains(t, gotEcho, "Postpended")
|
checkStringContains(t, gotEcho, "Appended")
|
||||||
|
|
||||||
gotEchoSub := fileContents(t, tmpdir, "root_echo_echosub.md")
|
gotEchoSub := fileContents(t, tmpdir, "root_echo_echosub.md")
|
||||||
checkStringContains(t, gotEchoSub, "Prepended")
|
checkStringContains(t, gotEchoSub, "Prepended")
|
||||||
checkStringContains(t, gotEchoSub, echoSubCmd.Long)
|
checkStringContains(t, gotEchoSub, echoSubCmd.Long)
|
||||||
checkStringContains(t, gotEchoSub, "Postpended")
|
checkStringContains(t, gotEchoSub, "Appended")
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileContents(t *testing.T, dir, filename string) string {
|
func fileContents(t *testing.T, dir, filename string) string {
|
||||||
|
|
Loading…
Reference in a new issue