MCPcopy
hub / github.com/spf13/cobra / TestGenYamlDocRunnable

Function TestGenYamlDocRunnable

doc/yaml_docs_test.go:75–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestGenYamlDocRunnable(t *testing.T) {
76 // Testing a runnable command: should contain the "usage" field
77 buf := new(bytes.Buffer)
78 if err := GenYaml(rootCmd, buf); err != nil {
79 t.Fatal(err)
80 }
81 output := buf.String()
82
83 checkStringContains(t, output, "usage: "+rootCmd.Use)
84}
85
86func BenchmarkGenYamlToFile(b *testing.B) {
87 file, err := os.CreateTemp("", "")

Callers

nothing calls this directly

Calls 3

GenYamlFunction · 0.85
StringMethod · 0.80
checkStringContainsFunction · 0.70

Tested by

no test coverage detected