-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtest_t.go
93 lines (77 loc) · 2.59 KB
/
gtest_t.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
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gtest
import (
"testing"
)
// T is the testing unit case management object.
type T struct {
*testing.T
}
// Assert checks `value` and `expect` EQUAL.
func (t *T) Assert(value, expect interface{}) {
Assert(value, expect)
}
// AssertEQ checks `value` and `expect` EQUAL, including their TYPES.
func (t *T) AssertEQ(value, expect interface{}) {
AssertEQ(value, expect)
}
// AssertNE checks `value` and `expect` NOT EQUAL.
func (t *T) AssertNE(value, expect interface{}) {
AssertNE(value, expect)
}
// AssertNQ checks `value` and `expect` NOT EQUAL, including their TYPES.
func (t *T) AssertNQ(value, expect interface{}) {
AssertNQ(value, expect)
}
// AssertGT checks `value` is GREATER THAN `expect`.
// Notice that, only string, integer and float types can be compared by AssertGT,
// others are invalid.
func (t *T) AssertGT(value, expect interface{}) {
AssertGT(value, expect)
}
// AssertGE checks `value` is GREATER OR EQUAL THAN `expect`.
// Notice that, only string, integer and float types can be compared by AssertGTE,
// others are invalid.
func (t *T) AssertGE(value, expect interface{}) {
AssertGE(value, expect)
}
// AssertLT checks `value` is LESS EQUAL THAN `expect`.
// Notice that, only string, integer and float types can be compared by AssertLT,
// others are invalid.
func (t *T) AssertLT(value, expect interface{}) {
AssertLT(value, expect)
}
// AssertLE checks `value` is LESS OR EQUAL THAN `expect`.
// Notice that, only string, integer and float types can be compared by AssertLTE,
// others are invalid.
func (t *T) AssertLE(value, expect interface{}) {
AssertLE(value, expect)
}
// AssertIN checks `value` is IN `expect`.
// The `expect` should be a slice,
// but the `value` can be a slice or a basic type variable.
func (t *T) AssertIN(value, expect interface{}) {
AssertIN(value, expect)
}
// AssertNI checks `value` is NOT IN `expect`.
// The `expect` should be a slice,
// but the `value` can be a slice or a basic type variable.
func (t *T) AssertNI(value, expect interface{}) {
AssertNI(value, expect)
}
// AssertNil asserts `value` is nil.
func (t *T) AssertNil(value interface{}) {
AssertNil(value)
}
// Error panics with given `message`.
func (t *T) Error(message ...interface{}) {
Error(message...)
}
// Fatal prints `message` to stderr and exit the process.
func (t *T) Fatal(message ...interface{}) {
Fatal(message...)
}