Example #1
0
func TestFirstOnlyEmpty(t *testing.T) {
	stream := functional.NilStream()
	var value int
	if output := FirstOnly(stream, emptyError, &value); output != emptyError {
		t.Errorf("Expected emptyError, got %v", output)
	}
}
Example #2
0
// OnDate returns a new R instance that represents happening once on a
// particular date and time.
func OnDate(targetTime time.Time) R {
	return RFunc(func(t time.Time) functional.Stream {
		if targetTime.After(t) {
			return functional.NewStreamFromValues([]time.Time{targetTime}, nil)
		}
		return functional.NilStream()
	})
}
Example #3
0
func (n nilRecurring) ForTime(t time.Time) functional.Stream {
	return functional.NilStream()
}
Example #4
0
func TestPageBufferEmptyLow(t *testing.T) {
	stream := functional.NilStream()
	pb := NewPageBuffer(make([]int, 6), -1)
	doConsume(t, pb, stream, nil)
	verifyPageFetched(t, pb, 0, 0, 0, true)
}