MCPcopy Create free account
hub / github.com/docker/cli / TestEOFWithError

Function TestEOFWithError

cli/connhelper/commandconn/commandconn_unix_test.go:23–35  ·  view source on GitHub ↗

For https://github.com/docker/cli/pull/1014#issuecomment-409308139

(t *testing.T)

Source from the content-addressed store, hash-verified

21
22// For https://github.com/docker/cli/pull/1014#issuecomment-409308139
23func TestEOFWithError(t *testing.T) {
24 ctx := context.TODO()
25 c, err := New(ctx, "sh", "-c", "echo hello; echo some error >&2; exit 42")
26 assert.NilError(t, err)
27 b := make([]byte, 32)
28 n, err := c.Read(b)
29 assert.Check(t, is.Equal(len("hello\n"), n))
30 assert.NilError(t, err)
31 n, err = c.Read(b)
32 assert.Check(t, is.Equal(0, n))
33 assert.ErrorContains(t, err, "some error")
34 assert.ErrorContains(t, err, "42")
35}
36
37func TestEOFWithoutError(t *testing.T) {
38 ctx := context.TODO()

Callers

nothing calls this directly

Calls 2

NewFunction · 0.70
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…