(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestSuggestFlagFromError(t *testing.T) { |
| 71 | // Given |
| 72 | app := buildExtendedTestCommand() |
| 73 | |
| 74 | for _, testCase := range []struct { |
| 75 | command, provided, expected string |
| 76 | }{ |
| 77 | {"", "hel", "--help"}, |
| 78 | {"", "soccer", "--socket"}, |
| 79 | {"config", "anot", "--another-flag"}, |
| 80 | } { |
| 81 | // When |
| 82 | res, _ := app.suggestFlagFromError( |
| 83 | errors.New(providedButNotDefinedErrMsg+testCase.provided), |
| 84 | testCase.command, |
| 85 | ) |
| 86 | |
| 87 | // Then |
| 88 | assert.Equal(t, fmt.Sprintf(SuggestDidYouMeanTemplate+"\n\n", testCase.expected), res) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestSuggestFlagFromErrorWrongError(t *testing.T) { |
| 93 | // Given |
nothing calls this directly
no test coverage detected