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

Function TestRequiresMinArgs

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

Source from the content-addressed store, hash-verified

29}
30
31func TestRequiresMinArgs(t *testing.T) {
32 testCases := []testCase{
33 {
34 validateFunc: RequiresMinArgs(0),
35 expectedError: "no error",
36 },
37 {
38 validateFunc: RequiresMinArgs(1),
39 expectedError: "at least 1 argument",
40 },
41 {
42 args: []string{"foo"},
43 validateFunc: RequiresMinArgs(2),
44 expectedError: "at least 2 arguments",
45 },
46 }
47 for _, tc := range testCases {
48 cmd := newDummyCommand(tc.validateFunc)
49 cmd.SetArgs(tc.args)
50 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
51 }
52}
53
54func TestRequiresMaxArgs(t *testing.T) {
55 testCases := []testCase{

Callers

nothing calls this directly

Calls 3

RequiresMinArgsFunction · 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…