Example #1
0
func TestFromRange(t *testing.T) {
	Convey("Given I have a context", t, func() {
		context := rivers.NewContext()

		Convey("And I have a range producer", func() {
			producer := producers.FromRange(1, 3)
			producer.Attach(context)

			Convey("When I produce data", func() {
				readable := producer.Produce()

				Convey("Then I can read the produced data from the stream", func() {
					So(readable.ReadAll(), ShouldResemble, []stream.T{1, 2, 3})
				})
			})
		})
	})
}
Example #2
0
func FromRange(from, to int) *Pipeline {
	return From(producers.FromRange(from, to))
}