github.com/gogf/gf/v2@v2.7.4/test/gtest/gtest_t.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gtest 8 9 import ( 10 "testing" 11 ) 12 13 // T is the testing unit case management object. 14 type T struct { 15 *testing.T 16 } 17 18 // Assert checks `value` and `expect` EQUAL. 19 func (t *T) Assert(value, expect interface{}) { 20 Assert(value, expect) 21 } 22 23 // AssertEQ checks `value` and `expect` EQUAL, including their TYPES. 24 func (t *T) AssertEQ(value, expect interface{}) { 25 AssertEQ(value, expect) 26 } 27 28 // AssertNE checks `value` and `expect` NOT EQUAL. 29 func (t *T) AssertNE(value, expect interface{}) { 30 AssertNE(value, expect) 31 } 32 33 // AssertNQ checks `value` and `expect` NOT EQUAL, including their TYPES. 34 func (t *T) AssertNQ(value, expect interface{}) { 35 AssertNQ(value, expect) 36 } 37 38 // AssertGT checks `value` is GREATER THAN `expect`. 39 // Notice that, only string, integer and float types can be compared by AssertGT, 40 // others are invalid. 41 func (t *T) AssertGT(value, expect interface{}) { 42 AssertGT(value, expect) 43 } 44 45 // AssertGE checks `value` is GREATER OR EQUAL THAN `expect`. 46 // Notice that, only string, integer and float types can be compared by AssertGTE, 47 // others are invalid. 48 func (t *T) AssertGE(value, expect interface{}) { 49 AssertGE(value, expect) 50 } 51 52 // AssertLT checks `value` is LESS EQUAL THAN `expect`. 53 // Notice that, only string, integer and float types can be compared by AssertLT, 54 // others are invalid. 55 func (t *T) AssertLT(value, expect interface{}) { 56 AssertLT(value, expect) 57 } 58 59 // AssertLE checks `value` is LESS OR EQUAL THAN `expect`. 60 // Notice that, only string, integer and float types can be compared by AssertLTE, 61 // others are invalid. 62 func (t *T) AssertLE(value, expect interface{}) { 63 AssertLE(value, expect) 64 } 65 66 // AssertIN checks `value` is IN `expect`. 67 // The `expect` should be a slice, 68 // but the `value` can be a slice or a basic type variable. 69 func (t *T) AssertIN(value, expect interface{}) { 70 AssertIN(value, expect) 71 } 72 73 // AssertNI checks `value` is NOT IN `expect`. 74 // The `expect` should be a slice, 75 // but the `value` can be a slice or a basic type variable. 76 func (t *T) AssertNI(value, expect interface{}) { 77 AssertNI(value, expect) 78 } 79 80 // AssertNil asserts `value` is nil. 81 func (t *T) AssertNil(value interface{}) { 82 AssertNil(value) 83 } 84 85 // Error panics with given `message`. 86 func (t *T) Error(message ...interface{}) { 87 Error(message...) 88 } 89 90 // Fatal prints `message` to stderr and exit the process. 91 func (t *T) Fatal(message ...interface{}) { 92 Fatal(message...) 93 }