forked from gogf/gf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdebug_z_unit_test.go
93 lines (77 loc) · 2.08 KB
/
gdebug_z_unit_test.go
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
package gdebug_test
import (
"testing"
"github.com/gogf/gf/v2/debug/gdebug"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
)
func Test_CallerPackage(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gdebug.CallerPackage(), "github.com/gogf/gf/v2/test/gtest")
})
}
func Test_CallerFunction(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gdebug.CallerFunction(), "C")
})
}
func Test_CallerFilePath(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.CallerFilePath(), "gtest_util.go"), true)
})
}
func Test_CallerDirectory(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.CallerDirectory(), "gtest"), true)
})
}
func Test_CallerFileLine(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.CallerFileLine(), "gtest_util.go:35"), true)
})
}
func Test_CallerFileLineShort(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.CallerFileLineShort(), "gtest_util.go:35"), true)
})
}
func Test_FuncPath(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gdebug.FuncPath(Test_FuncPath), "github.com/gogf/gf/v2/debug/gdebug_test.Test_FuncPath")
})
}
func Test_FuncName(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gdebug.FuncName(Test_FuncName), "gdebug_test.Test_FuncName")
})
}
func Test_PrintStack(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
gdebug.PrintStack()
})
}
func Test_GoroutineId(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.AssertGT(gdebug.GoroutineId(), 0)
})
}
func Test_Stack(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.Stack(), "gtest_util.go:35"), true)
})
}
func Test_StackWithFilter(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.Assert(gstr.Contains(gdebug.StackWithFilter([]string{"github.com"}), "gtest_util.go:35"), true)
})
}
func Test_BinVersion(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.AssertGT(len(gdebug.BinVersion()), 0)
})
}
func Test_BinVersionMd5(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
t.AssertGT(len(gdebug.BinVersionMd5()), 0)
})
}