(t *testing.T, buf Buffer)
| 500 | } |
| 501 | |
| 502 | func simple(t *testing.T, buf Buffer) { |
| 503 | buf.Write([]byte("hello world")) |
| 504 | data, err := ioutil.ReadAll(buf) |
| 505 | if err != nil { |
| 506 | t.Error(err.Error()) |
| 507 | } |
| 508 | if !bytes.Equal([]byte("hello world"), data) { |
| 509 | t.Error("Hello world failed.") |
| 510 | } |
| 511 | |
| 512 | buf.Write([]byte("hello world")) |
| 513 | data = make([]byte, 3) |
| 514 | buf.Read(data) |
| 515 | buf.Write([]byte(" yolo")) |
| 516 | data, err = ioutil.ReadAll(buf) |
| 517 | if err != nil { |
| 518 | t.Error(err.Error()) |
| 519 | } |
| 520 | if !bytes.Equal([]byte("lo world yolo"), data) { |
| 521 | t.Error("Buffer crossing error :(", string(data)) |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | func buildOutputs(t *testing.T, buf Buffer, size int64) (wrote []byte, read []byte) { |
| 526 | r := io.LimitReader(rand.Reader, size) |
no test coverage detected
searching dependent graphs…