MCPcopy
hub / github.com/uber-go/goleak / TestParseStack

Function TestParseStack

internal/stack/stacks_test.go:211–284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestParseStack(t *testing.T) {
212 tests := []struct {
213 name string
214 give string
215
216 id int
217 state string
218 firstFunc string
219 funcs []string
220 }{
221 {
222 name: "running",
223 give: joinLines(
224 "goroutine 1 [running]:",
225 "example.com/foo/bar.baz()",
226 " example.com/foo/bar.go:123",
227 ),
228 id: 1,
229 state: "running",
230 firstFunc: "example.com/foo/bar.baz",
231 funcs: []string{"example.com/foo/bar.baz"},
232 },
233 {
234 name: "without position",
235 give: joinLines(
236 "goroutine 1 [running]:",
237 "example.com/foo/bar.baz()",
238 // Oops, no "file:line" entry for this function.
239 "example.com/foo/bar.qux()",
240 " example.com/foo/bar.go:456",
241 ),
242 id: 1,
243 state: "running",
244 firstFunc: "example.com/foo/bar.baz",
245 funcs: []string{
246 "example.com/foo/bar.baz",
247 "example.com/foo/bar.qux",
248 },
249 },
250 {
251 name: "created by",
252 give: joinLines(
253 "goroutine 1 [running]:",
254 "example.com/foo/bar.baz()",
255 " example.com/foo/bar.go:123",
256 "created by example.com/foo/bar.qux",
257 " example.com/foo/bar.go:456",
258 ),
259 id: 1,
260 state: "running",
261 firstFunc: "example.com/foo/bar.baz",
262 funcs: []string{
263 "example.com/foo/bar.baz",
264 },
265 },
266 }
267
268 for _, tt := range tests {

Callers

nothing calls this directly

Calls 10

joinLinesFunction · 0.85
newStackParserFunction · 0.85
ParseMethod · 0.80
LenMethod · 0.80
IDMethod · 0.80
StateMethod · 0.80
FirstFunctionMethod · 0.80
HasFunctionMethod · 0.80
FullMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…