MCPcopy
hub / github.com/helm/helm / TestArgs

Function TestArgs

pkg/cmd/require/args_test.go:27–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestArgs(t *testing.T) {
28 runTestCases(t, []testCase{{
29 validateFunc: NoArgs,
30 }, {
31 args: []string{"one"},
32 validateFunc: NoArgs,
33 wantError: `"root" accepts no arguments`,
34 }, {
35 args: []string{"one"},
36 validateFunc: ExactArgs(1),
37 }, {
38 validateFunc: ExactArgs(1),
39 wantError: `"root" requires 1 argument`,
40 }, {
41 validateFunc: ExactArgs(2),
42 wantError: `"root" requires 2 arguments`,
43 }, {
44 args: []string{"one"},
45 validateFunc: MaximumNArgs(1),
46 }, {
47 args: []string{"one", "two"},
48 validateFunc: MaximumNArgs(1),
49 wantError: `"root" accepts at most 1 argument`,
50 }, {
51 validateFunc: MinimumNArgs(1),
52 wantError: `"root" requires at least 1 argument`,
53 }, {
54 args: []string{"one", "two"},
55 validateFunc: MinimumNArgs(1),
56 }})
57}
58
59type testCase struct {
60 args []string

Callers

nothing calls this directly

Calls 4

runTestCasesFunction · 0.85
ExactArgsFunction · 0.85
MaximumNArgsFunction · 0.85
MinimumNArgsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…