(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestByteBufferWriteTo(t *testing.T) { |
| 46 | expectedS := "foobarbaz" |
| 47 | var bb ByteBuffer |
| 48 | bb.WriteString(expectedS[:3]) |
| 49 | bb.WriteString(expectedS[3:]) |
| 50 | |
| 51 | wt := (io.WriterTo)(&bb) |
| 52 | var w bytes.Buffer |
| 53 | for i := 0; i < 10; i++ { |
| 54 | n, err := wt.WriteTo(&w) |
| 55 | if n != int64(len(expectedS)) { |
| 56 | t.Fatalf("unexpected n returned from WriteTo: %d. Expecting %d", n, len(expectedS)) |
| 57 | } |
| 58 | if err != nil { |
| 59 | t.Fatalf("unexpected error: %s", err) |
| 60 | } |
| 61 | s := string(w.Bytes()) |
| 62 | if s != expectedS { |
| 63 | t.Fatalf("unexpected string written %q. Expecting %q", s, expectedS) |
| 64 | } |
| 65 | w.Reset() |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | func TestByteBufferGetPutSerial(t *testing.T) { |
| 70 | testByteBufferGetPut(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…