MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / TestUsage

Function TestUsage

cmd/root_test.go:110–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestUsage(t *testing.T) {
111 var b bytes.Buffer
112 rootCmd.ResetFlags()
113 rootCmd.SetOutput(&b)
114 initRootCmd()
115
116 if err := rootCmd.ParseFlags([]string{}); err != nil {
117 t.Fatalf("exepected nil; got %v", err)
118 }
119 if err := rootCmd.Execute(); err != nil {
120 t.Fatalf("exepected nil; got %v", err)
121 }
122 if got := b.String(); got == "" {
123 t.Fatalf("expected not empty string; got %q", got)
124 }
125}
126
127func TestShowErrorOnly(t *testing.T) {
128 expErr := errors.New("error")

Callers

nothing calls this directly

Calls 2

initRootCmdFunction · 0.85
SetOutputMethod · 0.80

Tested by

no test coverage detected