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

Method TestIsBinary

utils/binary/read_test.go:126–148  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

124}
125
126func (s *BinarySuite) TestIsBinary(c *C) {
127 buf := bytes.NewBuffer(nil)
128 buf.Write(bytes.Repeat([]byte{'A'}, sniffLen))
129 buf.Write([]byte{0})
130 ok, err := IsBinary(buf)
131 c.Assert(err, IsNil)
132 c.Assert(ok, Equals, false)
133
134 buf.Reset()
135
136 buf.Write(bytes.Repeat([]byte{'A'}, sniffLen-1))
137 buf.Write([]byte{0})
138 ok, err = IsBinary(buf)
139 c.Assert(err, IsNil)
140 c.Assert(ok, Equals, true)
141
142 buf.Reset()
143
144 buf.Write(bytes.Repeat([]byte{'A'}, 10))
145 ok, err = IsBinary(buf)
146 c.Assert(err, IsNil)
147 c.Assert(ok, Equals, false)
148}

Callers

nothing calls this directly

Calls 3

IsBinaryFunction · 0.85
WriteMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected