MCPcopy Index your code
hub / github.com/cli/cli / TestGenMdTree

Function TestGenMdTree

internal/docs/markdown_test.go:102–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestGenMdTree(t *testing.T) {
103 c := &cobra.Command{Use: "do [OPTIONS] arg1 arg2"}
104 tmpdir, err := os.MkdirTemp("", "test-gen-md-tree")
105 if err != nil {
106 t.Fatalf("Failed to create tmpdir: %v", err)
107 }
108 defer os.RemoveAll(tmpdir)
109
110 if err := GenMarkdownTreeCustom(c, tmpdir, func(s string) string { return s }, func(s string) string { return s }); err != nil {
111 t.Fatalf("GenMarkdownTree failed: %v", err)
112 }
113
114 if _, err := os.Stat(filepath.Join(tmpdir, "do.md")); err != nil {
115 t.Fatalf("Expected file 'do.md' to exist")
116 }
117}
118
119func BenchmarkGenMarkdownToFile(b *testing.B) {
120 file, err := os.CreateTemp(b.TempDir(), "")

Callers

nothing calls this directly

Calls 2

GenMarkdownTreeCustomFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected