...
1
2
3
4
5 package trace
6
7 import "testing"
8
9 func TestPanicEvent(t *testing.T) {
10
11 ev := syncEvent(nil, 0)
12
13 mustPanic(t, func() {
14 _ = ev.Range()
15 })
16 mustPanic(t, func() {
17 _ = ev.Metric()
18 })
19 mustPanic(t, func() {
20 _ = ev.Log()
21 })
22 mustPanic(t, func() {
23 _ = ev.Task()
24 })
25 mustPanic(t, func() {
26 _ = ev.Region()
27 })
28 mustPanic(t, func() {
29 _ = ev.Label()
30 })
31 mustPanic(t, func() {
32 _ = ev.RangeAttributes()
33 })
34 }
35
36 func mustPanic(t *testing.T, f func()) {
37 defer func() {
38 if r := recover(); r == nil {
39 t.Fatal("failed to panic")
40 }
41 }()
42 f()
43 }
44
View as plain text