MCPcopy Index your code
hub / github.com/helm/helm / checkFileCompletion

Function checkFileCompletion

pkg/cmd/completion_test.go:30–59  ·  view source on GitHub ↗

Check if file completion should be performed according to parameter 'shouldBePerformed'

(t *testing.T, cmdName string, shouldBePerformed bool)

Source from the content-addressed store, hash-verified

28
29// Check if file completion should be performed according to parameter 'shouldBePerformed'
30func checkFileCompletion(t *testing.T, cmdName string, shouldBePerformed bool) {
31 t.Helper()
32 storage := storageFixture()
33 storage.Create(&release.Release{
34 Name: "myrelease",
35 Info: &release.Info{Status: common.StatusDeployed},
36 Chart: &chart.Chart{
37 Metadata: &chart.Metadata{
38 Name: "Myrelease-Chart",
39 Version: "1.2.3",
40 },
41 },
42 Version: 1,
43 })
44
45 testcmd := fmt.Sprintf("__complete %s ''", cmdName)
46 _, out, err := executeActionCommandC(storage, testcmd)
47 if err != nil {
48 t.Errorf("unexpected error, %s", err)
49 }
50 if !strings.Contains(out, "ShellCompDirectiveNoFileComp") != shouldBePerformed {
51 if shouldBePerformed {
52 t.Errorf("Unexpected directive ShellCompDirectiveNoFileComp when completing '%s'", cmdName)
53 } else {
54
55 t.Errorf("Did not receive directive ShellCompDirectiveNoFileComp when completing '%s'", cmdName)
56 }
57 t.Log(out)
58 }
59}
60
61func TestCompletionFileCompletion(t *testing.T) {
62 checkFileCompletion(t, "completion", false)

Calls 5

storageFixtureFunction · 0.85
executeActionCommandCFunction · 0.85
HelperMethod · 0.80
ContainsMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…