|
@@ -283,6 +283,22 @@ func TestSort(t *testing.T) {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func TestSplit(t *testing.T) {
|
|
|
|
+ assert.Panics(t, func() {
|
|
|
|
+ Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(0).Done()
|
|
|
|
+ })
|
|
|
|
+ var chunks [][]interface{}
|
|
|
|
+ Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(4).ForEach(func(item interface{}) {
|
|
|
|
+ chunk := item.([]interface{})
|
|
|
|
+ chunks = append(chunks, chunk)
|
|
|
|
+ })
|
|
|
|
+ assert.EqualValues(t, [][]interface{}{
|
|
|
|
+ {1, 2, 3, 4},
|
|
|
|
+ {5, 6, 7, 8},
|
|
|
|
+ {9, 10},
|
|
|
|
+ }, chunks)
|
|
|
|
+}
|
|
|
|
+
|
|
func TestTail(t *testing.T) {
|
|
func TestTail(t *testing.T) {
|
|
var result int
|
|
var result int
|
|
Just(1, 2, 3, 4).Tail(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
|
Just(1, 2, 3, 4).Tail(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|