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

Function TestSuggestFlag

suggestions_test.go:38–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestSuggestFlag(t *testing.T) {
39 // Given
40 app := buildExtendedTestCommand()
41
42 for _, testCase := range []struct {
43 provided, expected string
44 }{
45 {"", ""},
46 {"a", "--another-flag"},
47 {"hlp", "--help"},
48 {"k", ""},
49 {"s", "-s"},
50 } {
51 // When
52 res := suggestFlag(app.Flags, testCase.provided, false)
53
54 // Then
55 assert.Equal(t, testCase.expected, res)
56 }
57}
58
59func TestSuggestFlagHideHelp(t *testing.T) {
60 // Given

Callers

nothing calls this directly

Calls 2

buildExtendedTestCommandFunction · 0.85
suggestFlagFunction · 0.85

Tested by

no test coverage detected