MCPcopy Create free account
hub / github.com/djherbis/buffer / TestWrapper

Function TestWrapper

wrapio/wrapio_test.go:11–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestWrapper(t *testing.T) {
12 if file, err := ioutil.TempFile("", "wrap.test"); err == nil {
13 defer os.Remove(file.Name())
14 defer file.Close()
15 file.Write([]byte("abcdef"))
16
17 data := make([]byte, 12)
18
19 w := NewWrapper(file, 6, 1, 6)
20 if n, err := w.ReadAt(data, 1); err == nil || err == io.EOF {
21 if !bytes.Equal(data[:n], []byte("cdefa")) {
22 t.Errorf("Exp cdefa, Got %s", data[:n])
23 }
24 } else {
25 t.Error(err.Error())
26 }
27 }
28}
29
30func TestWrap(t *testing.T) {
31 if file, err := ioutil.TempFile("", "wrap.test"); err == nil {

Callers

nothing calls this directly

Calls 5

ReadAtMethod · 0.95
NewWrapperFunction · 0.85
NameMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…