(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestWriteHeader(t *testing.T) { |
| 11 | for i, test := range RWTestCases { |
| 12 | t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { |
| 13 | buf := &bytes.Buffer{} |
| 14 | err := WriteHeader(buf, test.Header) |
| 15 | if test.Err && err == nil { |
| 16 | t.Errorf("expected error, got nil") |
| 17 | } |
| 18 | if !test.Err && err != nil { |
| 19 | t.Errorf("unexpected error: %s", err) |
| 20 | } |
| 21 | if test.Err { |
| 22 | return |
| 23 | } |
| 24 | if bts := buf.Bytes(); !bytes.Equal(bts, test.Data) { |
| 25 | t.Errorf("WriteHeader()\nwrote:\n\t%08b\nwant:\n\t%08b", bts, test.Data) |
| 26 | } |
| 27 | }) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func BenchmarkWriteHeader(b *testing.B) { |
| 32 | for _, bench := range RWBenchCases { |
nothing calls this directly
no test coverage detected
searching dependent graphs…