This file is indexed.

/usr/share/gocode/src/github.com/franela/goblin/describe_test.go is in golang-github-franela-goblin-dev 0.0.1+git20160123.62.889391d-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
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package goblin

import (
	"testing"
)

func TestBefore(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)

	g.Describe("Numbers", func() {
		before := 0

		g.Before(func() {
			before++
		})

		g.It("Should have called before", func() {
			g.Assert(before).Equal(1)
		})

		g.It("Should have called before only once", func() {
			g.Assert(before).Equal(1)
		})
	})

	if fakeTest.Failed() {
		t.Fatal("Failed")
	}
}

func TestMultipleBefore(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)

	g.Describe("Numbers", func() {
		before := 0

		g.Before(func() {
			before++
		})

		g.Before(func() {
			before++
		})

		g.It("Should have called all the registered before", func() {
			g.Assert(before).Equal(2)
		})
	})

	if fakeTest.Failed() {
		t.Fatal("Failed")
	}
}

func TestNestedBefore(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)

	g.Describe("Numbers", func() {
		before := 0

		g.Before(func() {
			before++
		})

		g.Describe("Addition", func() {
			g.Before(func() {
				before++
			})

			g.It("Should have called all the registered before", func() {
				g.Assert(before).Equal(2)
			})

			g.It("Should have called all the registered before only once", func() {
				g.Assert(before).Equal(2)
			})
		})

	})

	if fakeTest.Failed() {
		t.Fatal("Failed")
	}
}

func TestAfter(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)
	after := 0
	g.Describe("Numbers", func() {

		g.After(func() {
			after++
		})

		g.It("Should call after only once", func() {
			g.Assert(after).Equal(0)
		})

		g.It("Should call after only once", func() {
			g.Assert(after).Equal(0)
		})
	})

	if fakeTest.Failed() || after != 1 {
		t.Fatal("Failed")
	}
}

func TestMultipleAfter(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)

	after := 0
	g.Describe("Numbers", func() {

		g.After(func() {
			after++
		})

		g.After(func() {
			after++
		})

		g.It("Should call all the registered after", func() {
			g.Assert(after).Equal(0)
		})
	})

	if fakeTest.Failed() && after != 2 {
		t.Fatal("Failed")
	}
}

func TestNestedAfter(t *testing.T) {
	fakeTest := testing.T{}

	g := Goblin(&fakeTest)
	after := 0
	g.Describe("Numbers", func() {

		g.After(func() {
			after++
		})

		g.Describe("Addition", func() {
			g.After(func() {
				after++
			})

			g.It("Should call all the registered after", func() {
				g.Assert(after).Equal(0)
			})

			g.It("Should have called all the registered after only once", func() {
				g.Assert(after).Equal(0)
			})
		})

	})

	if fakeTest.Failed() || after != 2 {
		t.Fatal("Failed")
	}
}