diff options
Diffstat (limited to 'internal/tests/integration/integration_test.go')
| -rw-r--r-- | internal/tests/integration/integration_test.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/internal/tests/integration/integration_test.go b/internal/tests/integration/integration_test.go index bc79862a..a57d8d0b 100644 --- a/internal/tests/integration/integration_test.go +++ b/internal/tests/integration/integration_test.go @@ -25,13 +25,22 @@ import ( const isWindows = runtime.GOOS == "windows" // a convenience... -func inOutTest(t *testing.T, i, o string) { +func inOutTest(t *testing.T, i, o string, args ...string) { t.Helper() - stdout, stderr, err := cmd(t, "-i", i).run() + args = append(args, "-i", i) + stdout, stderr, err := cmd(t, args...).run() assertSuccess(t, stdout, stderr, err, o) } +func inOutContainsError(t *testing.T, i, e string, args ...string) { + t.Helper() + + args = append(args, "-i", i) + stdout, stderr, err := cmd(t, args...).run() + assertFailed(t, stdout, stderr, err, e) +} + func inOutTestExperimental(t *testing.T, i, o string) { t.Helper() @@ -56,6 +65,14 @@ func assertSuccess(t *testing.T, o, e string, err error, expected string) { require.NoError(t, err) } +func assertFailed(t *testing.T, o, e string, err error, expected string) { + t.Helper() + + assert.Contains(t, e, expected) + assert.Equal(t, "", o) + require.Error(t, err) +} + // mirrorHandler - reflects back the HTTP headers from the request func mirrorHandler(w http.ResponseWriter, r *http.Request) { type Req struct { |
