MCPcopy
hub / github.com/go-git/go-git / TestNewContextWriter

Method TestNewContextWriter

utils/ioutil/common_test.go:95–109  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

93}
94
95func (s *CommonSuite) TestNewContextWriter(c *C) {
96 buf := bytes.NewBuffer(nil)
97 ctx, close := context.WithCancel(context.Background())
98
99 r := NewContextWriter(ctx, buf)
100
101 n, err := r.Write([]byte("1"))
102 c.Assert(n, Equals, 1)
103 c.Assert(err, IsNil)
104
105 close()
106 n, err = r.Write([]byte("1"))
107 c.Assert(n, Equals, 0)
108 c.Assert(err, NotNil)
109}
110
111func (s *CommonSuite) TestNewContextWriteCloser(c *C) {
112 buf := NewWriteCloser(bytes.NewBuffer(nil), &closer{})

Callers

nothing calls this directly

Calls 2

NewContextWriterFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected