Example #1
0
func testForEachMessage(mbox store.Folder, lowID, highID, suffix,
	expectedCount uint64, t *testing.T) {

	counter := uint64(0)
	err := mbox.ForEachMessage(lowID, highID, suffix,
		func(index, suffix uint64, msg []byte) error {
			counter++
			return nil
		})
	if err != nil {
		t.Errorf("For lowID %d, highID %d, suffix %d, got error %v", lowID,
			highID, suffix, err)
	}
	if expectedCount != counter {
		t.Errorf("For lowID %d, highID %d, suffix %d, expected counter %d got %d",
			lowID, highID, suffix, expectedCount, counter)
	}
}