-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstack_test.go
More file actions
51 lines (45 loc) · 783 Bytes
/
Copy pathstack_test.go
File metadata and controls
51 lines (45 loc) · 783 Bytes
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
package que
import (
"strings"
"testing"
)
type stackS struct{}
func (ss *stackS) stackA() (s string) {
defer func() {
e := recover()
if e != nil {
s = Stack(3)
}
}()
ss.stackB()
return
}
func (*stackS) stackB() {
defer func() {
e := recover()
if e != nil {
panic(e)
}
}()
var i int
i++
i *= 5
panic(i)
}
func TestStack(t *testing.T) {
ss := &stackS{}
stack := ss.stackA()
t.Log(stack)
stacks := []string{
"github.com/tnclong/go-que/stack_test.go:36",
"github.com/tnclong/go-que/stack_test.go:17",
"github.com/tnclong/go-que/stack_test.go:31",
"tnclong/go-que/stack_test.go:25",
"tnclong/go-que/stack_test.go:14",
}
for _, s := range stacks {
if !strings.Contains(stack, s) {
t.Fatalf("want stack has caller: %s", s)
}
}
}