(t *testing.T)
| 404 | } |
| 405 | |
| 406 | func TestFile(t *testing.T) { |
| 407 | file, err := ioutil.TempFile("", "buffer") |
| 408 | if err != nil { |
| 409 | t.Error(err.Error()) |
| 410 | } |
| 411 | defer os.Remove(file.Name()) |
| 412 | defer file.Close() |
| 413 | |
| 414 | buf := NewFile(1024, file) |
| 415 | checkCap(t, buf, 1024) |
| 416 | runPerfectSeries(t, buf) |
| 417 | buf.Reset() |
| 418 | |
| 419 | buf = NewFile(3, file) |
| 420 | buf.Write([]byte("abc")) |
| 421 | buf.Read(make([]byte, 1)) |
| 422 | buf.Write([]byte("a")) |
| 423 | d, _ := ioutil.ReadAll(buf) |
| 424 | if !bytes.Equal(d, []byte("bca")) { |
| 425 | t.Error("back and forth error!") |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | func TestMem(t *testing.T) { |
| 430 | buf := New(1024) |
nothing calls this directly
no test coverage detected
searching dependent graphs…