File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 11package iter_test
22
33import (
4+ "fmt"
45 "testing"
56
67 "github.com/BooleanCat/go-functional/internal/assert"
78 "github.com/BooleanCat/go-functional/iter"
89)
910
11+ func ExampleDrop () {
12+ counter := iter .Drop [int ](iter .Count (), 2 )
13+ fmt .Println (counter .Next ().Unwrap ())
14+ // Output: 2
15+ }
16+
1017func TestDrop (t * testing.T ) {
1118 counter := iter .Drop [int ](iter .Count (), 2 )
1219 assert .Equal (t , counter .Next ().Unwrap (), 2 )
Original file line number Diff line number Diff line change 11package iter_test
22
33import (
4+ "fmt"
45 "testing"
56
67 "github.com/BooleanCat/go-functional/internal/assert"
78 "github.com/BooleanCat/go-functional/iter"
89)
910
11+ func ExampleTake () {
12+ iter := iter .Take [int ](iter .Count (), 2 )
13+ fmt .Println (iter .Next ())
14+ fmt .Println (iter .Next ())
15+ fmt .Println (iter .Next ())
16+ // Output:
17+ // Some(0)
18+ // Some(1)
19+ // None
20+ }
21+
1022func TestTakeIter (t * testing.T ) {
1123 iter := iter .Take [int ](iter .Count (), 2 )
1224 assert .Equal (t , iter .Next ().Unwrap (), 0 )
You can’t perform that action at this time.
0 commit comments