MCPcopy Create free account
hub / github.com/Soft/iter / TestFunc

Function TestFunc

iterator_test.go:43–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestFunc(t *testing.T) {
44 v := 0
45 it := Func(func() Option[int] {
46 if v < 3 {
47 ret := Some(v)
48 v++
49 return ret
50 } else {
51 return None[int]()
52 }
53 })
54 equals(t, it.Next().Unwrap(), 0)
55 equals(t, it.Next().Unwrap(), 1)
56 equals(t, it.Next().Unwrap(), 2)
57 equals(t, it.Next().IsNone(), true)
58}
59
60func TestEmpty(t *testing.T) {
61 it := Empty[int]()

Callers

nothing calls this directly

Calls 6

FuncFunction · 0.85
SomeFunction · 0.85
equalsFunction · 0.85
UnwrapMethod · 0.80
IsNoneMethod · 0.80
NextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…