RunAndExpectFailure runs the given command, expects it to fail and returns its output lines.
(tb testing.TB, args ...string)
| 259 | |
| 260 | // RunAndExpectFailure runs the given command, expects it to fail and returns its output lines. |
| 261 | func (e *CLITest) RunAndExpectFailure(tb testing.TB, args ...string) (stdout, stderr []string) { |
| 262 | tb.Helper() |
| 263 | |
| 264 | var err error |
| 265 | |
| 266 | stdout, stderr, err = e.Run(tb, true, args...) |
| 267 | require.Error(tb, err, "'kopia %v' succeeded, but expected failure", strings.Join(args, " ")) |
| 268 | |
| 269 | return stdout, stderr |
| 270 | } |
| 271 | |
| 272 | // RunAndVerifyOutputLineCount runs the given command and asserts it returns the given number of output lines, then returns them. |
| 273 | func (e *CLITest) RunAndVerifyOutputLineCount(tb testing.TB, wantLines int, args ...string) []string { |