Debian Codegraph @

internal/stack/stack_test.go

raw symbols SCIP
1 package stack_test
2
3 import (
4 "runtime"
5 "testing"
6
7 "github.com/mmcloughlin/avo/internal/stack"
8 )
9
10 const pkg = "github.com/mmcloughlin/avo/internal/stack_test"
11
12 func TestFramesFirst(t *testing.T) {
13 fs := stack.Frames(0, 1)
14 if len(fs) == 0 {
15 t.Fatalf("empty slice")
16 }
17 got := fs[0].Function
18 expect := pkg + ".TestFramesFirst"
19 if got != expect {
20 t.Fatalf("bad function name %s; expect %s", got, expect)
21 }
22 }
23
24 func TestMatchFirst(t *testing.T) {
25 first := stack.Match(0, func(_ runtime.Frame) bool { return true })
26 if first == nil {
27 t.Fatalf("nil match")
28 }
29 got := first.Function
30 expect := pkg + ".TestMatchFirst"
31 if got != expect {
32 t.Fatalf("bad function name %s; expect %s", got, expect)
33 }
34 }