10 ms TODO Keep enriching tests
(t *testing.T)
| 17 | |
| 18 | // TODO Keep enriching tests |
| 19 | func TestLeak(t *testing.T) { |
| 20 | var ( |
| 21 | count = 100 |
| 22 | fooErr = errors.New("") |
| 23 | ) |
| 24 | |
| 25 | observables := map[string]func(context.Context) Observable{ |
| 26 | "Amb": func(ctx context.Context) Observable { |
| 27 | obs := FromChannel(make(chan Item), WithContext(ctx)) |
| 28 | return Amb([]Observable{obs}, WithContext(ctx)) |
| 29 | }, |
| 30 | "CombineLatest": func(ctx context.Context) Observable { |
| 31 | return CombineLatest(func(i ...interface{}) interface{} { |
| 32 | sum := 0 |
| 33 | for _, v := range i { |
| 34 | if v == nil { |
| 35 | continue |
| 36 | } |
| 37 | sum += v.(int) |
| 38 | } |
| 39 | return sum |
| 40 | }, []Observable{ |
| 41 | Just(1, 2)(), |
| 42 | Just(10, 11)(), |
| 43 | }) |
| 44 | }, |
| 45 | "Concat": func(ctx context.Context) Observable { |
| 46 | return Concat([]Observable{ |
| 47 | Just(1, 2, 3)(), |
| 48 | Just(4, 5, 6)(), |
| 49 | }) |
| 50 | }, |
| 51 | "FromChannel": func(ctx context.Context) Observable { |
| 52 | return FromChannel(getChannel(ctx), WithContext(ctx)) |
| 53 | }, |
| 54 | "FromEventSource": func(ctx context.Context) Observable { |
| 55 | return FromEventSource(getChannel(ctx), WithContext(ctx)) |
| 56 | }, |
| 57 | } |
| 58 | |
| 59 | actions := map[string]func(context.Context, Observable){ |
| 60 | "All": func(ctx context.Context, obs Observable) { |
| 61 | obs.All(func(_ interface{}) bool { |
| 62 | return true |
| 63 | }, WithContext(ctx)) |
| 64 | }, |
| 65 | "Average": func(ctx context.Context, obs Observable) { |
| 66 | obs.AverageInt(WithContext(ctx)) |
| 67 | }, |
| 68 | "BufferWithTime": func(ctx context.Context, obs Observable) { |
| 69 | obs.BufferWithTime(WithDuration(time.Millisecond), WithContext(ctx)) |
| 70 | }, |
| 71 | "Connect": func(ctx context.Context, obs Observable) { |
| 72 | obs.Connect(ctx) |
| 73 | }, |
| 74 | "Contains": func(ctx context.Context, obs Observable) { |
| 75 | obs.Contains(func(i interface{}) bool { |
| 76 | return i == 2 |
nothing calls this directly
no test coverage detected
searching dependent graphs…