Verify that contents of buf match the string s.
(t *testing.T, testname string, buf *Buffer, s string)
| 29 | |
| 30 | // Verify that contents of buf match the string s. |
| 31 | func check(t *testing.T, testname string, buf *Buffer, s string) { |
| 32 | bytes := buf.Bytes() |
| 33 | str := buf.String() |
| 34 | if buf.Len() != len(bytes) { |
| 35 | t.Errorf("%s: buf.Len() == %d, len(buf.Bytes()) == %d", testname, buf.Len(), len(bytes)) |
| 36 | } |
| 37 | |
| 38 | if buf.Len() != len(str) { |
| 39 | t.Errorf("%s: buf.Len() == %d, len(buf.String()) == %d", testname, buf.Len(), len(str)) |
| 40 | } |
| 41 | |
| 42 | if buf.Len() != len(s) { |
| 43 | t.Errorf("%s: buf.Len() == %d, len(s) == %d", testname, buf.Len(), len(s)) |
| 44 | } |
| 45 | |
| 46 | if string(bytes) != s { |
| 47 | t.Errorf("%s: string(buf.Bytes()) == %q, s == %q", testname, string(bytes), s) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Fill buf through n writes of string fus. |
| 52 | // The initial contents of buf corresponds to the string s; |
no test coverage detected