(t *testing.T)
| 736 | } |
| 737 | |
| 738 | func TestBufferSubApply(t *testing.T) { |
| 739 | var b Buffer |
| 740 | defer b.Release() |
| 741 | b.appendOwned(NewViewWithData([]byte("0123"))) |
| 742 | b.appendOwned(NewViewWithData([]byte("45678"))) |
| 743 | b.appendOwned(NewViewWithData([]byte("9abcd"))) |
| 744 | data := []byte("0123456789abcd") |
| 745 | |
| 746 | for i := 0; i <= len(data); i++ { |
| 747 | for j := i; j <= len(data); j++ { |
| 748 | t.Run(fmt.Sprintf("SubApply(%d,%d)", i, j), func(t *testing.T) { |
| 749 | var got []byte |
| 750 | b.SubApply(i, j-i, func(v *View) { |
| 751 | got = append(got, v.AsSlice()...) |
| 752 | }) |
| 753 | if want := data[i:j]; !bytes.Equal(got, want) { |
| 754 | t.Errorf("got = %q; want %q", got, want) |
| 755 | } |
| 756 | }) |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | func doSaveAndLoad(t *testing.T, toSave, toLoad *Buffer) { |
| 762 | t.Helper() |
nothing calls this directly
no test coverage detected
searching dependent graphs…