MCPcopy Create free account
hub / github.com/ReactiveX/RxGo / TestLeak

Function TestLeak

observable_operator_random_test.go:19–122  ·  view source on GitHub ↗

10 ms TODO Keep enriching tests

(t *testing.T)

Source from the content-addressed store, hash-verified

17
18// TODO Keep enriching tests
19func 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

Callers

nothing calls this directly

Calls 15

FromChannelFunction · 0.85
WithContextFunction · 0.85
AmbFunction · 0.85
CombineLatestFunction · 0.85
JustFunction · 0.85
ConcatFunction · 0.85
getChannelFunction · 0.85
FromEventSourceFunction · 0.85
WithDurationFunction · 0.85
randomTimeFunction · 0.85
AllMethod · 0.65
AverageIntMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…