MCPcopy Index your code
hub / github.com/docker/cli / TestExactArgs

Function TestExactArgs

cli/required_test.go:110–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestExactArgs(t *testing.T) {
111 testCases := []testCase{
112 {
113 validateFunc: ExactArgs(0),
114 expectedError: "no error",
115 },
116 {
117 validateFunc: ExactArgs(1),
118 expectedError: "1 argument",
119 },
120 {
121 validateFunc: ExactArgs(2),
122 expectedError: "2 arguments",
123 },
124 }
125 for _, tc := range testCases {
126 cmd := newDummyCommand(tc.validateFunc)
127 cmd.SetArgs(tc.args)
128 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
129 }
130}
131
132type testCase struct {
133 args []string

Callers

nothing calls this directly

Calls 3

ExactArgsFunction · 0.85
newDummyCommandFunction · 0.85
SetArgsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…