This file is indexed.

/usr/share/gocode/src/gopkg.in/eapache/channels.v1/resizable_channel_test.go is in golang-gopkg-eapache-channels.v1-dev 1.1.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package channels

import (
	"math/rand"
	"testing"
)

func TestResizableChannel(t *testing.T) {
	var ch *ResizableChannel

	ch = NewResizableChannel()
	testChannel(t, "default resizable channel", ch)

	ch = NewResizableChannel()
	testChannelPair(t, "default resizable channel", ch, ch)

	ch = NewResizableChannel()
	ch.Resize(Infinity)
	testChannel(t, "infinite resizable channel", ch)

	ch = NewResizableChannel()
	ch.Resize(Infinity)
	testChannelPair(t, "infinite resizable channel", ch, ch)

	ch = NewResizableChannel()
	ch.Resize(5)
	testChannel(t, "5-buffer resizable channel", ch)

	ch = NewResizableChannel()
	ch.Resize(5)
	testChannelPair(t, "5-buffer resizable channel", ch, ch)

	ch = NewResizableChannel()
	testChannelConcurrentAccessors(t, "resizable channel", ch)
}

func TestResizableChannelOnline(t *testing.T) {
	stopper := make(chan bool)
	ch := NewResizableChannel()
	go func() {
		for i := 0; i < 1000; i++ {
			ch.In() <- i
		}
		<-stopper
		ch.Close()
	}()

	go func() {
		for i := 0; i < 1000; i++ {
			ch.Resize(BufferCap(rand.Intn(50) + 1))
		}
		close(stopper)
	}()

	for i := 0; i < 1000; i++ {
		val := <-ch.Out()
		if i != val.(int) {
			t.Fatal("resizable channel expected", i, "but got", val.(int))
		}
	}
}