MCPcopy
hub / github.com/urfave/cli / TestFishCompletion

Function TestFishCompletion

fish_test.go:12–42  ·  fish_test.go::TestFishCompletion
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestFishCompletion(t *testing.T) {
13 // Given
14 cmd := buildExtendedTestCommand()
15 cmd.Flags = append(cmd.Flags,
16 &StringFlag{
17 Name: "logfile",
18 TakesFile: true,
19 },
20 &StringSliceFlag{
21 Name: "foofile",
22 TakesFile: true,
23 })
24 cmd.setupCommandGraph()
25
26 oldTemplate := FishCompletionTemplate
27 defer func() { FishCompletionTemplate = oldTemplate }()
28 FishCompletionTemplate = "{{something"
29
30 // test error case
31 _, err1 := cmd.ToFishCompletion()
32 assert.Error(t, err1)
33
34 // reset the template
35 FishCompletionTemplate = oldTemplate
36 // When
37 res, err := cmd.ToFishCompletion()
38
39 // Then
40 require.NoError(t, err)
41 expectFileContent(t, "testdata/expected-fish-full.fish", res)
42}
43
44func TestFishCompletionShellComplete(t *testing.T) {
45 cmd := buildExtendedTestCommand()

Callers

nothing calls this directly

Calls 5

buildExtendedTestCommandFunction · 0.85
expectFileContentFunction · 0.85
setupCommandGraphMethod · 0.80
ToFishCompletionMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected