MCPcopy
hub / github.com/gogf/gf / C

Function C

test/gtest/gtest_util.go:29–37  ·  view source on GitHub ↗

C creates a unit testing case. The parameter `t` is the pointer to testing.T of stdlib (*testing.T). The parameter `f` is the closure function for unit testing case.

(t *testing.T, f func(t *T))

Source from the content-addressed store, hash-verified

27// The parameter `t` is the pointer to testing.T of stdlib (*testing.T).
28// The parameter `f` is the closure function for unit testing case.
29func C(t *testing.T, f func(t *T)) {
30 defer func() {
31 if err := recover(); err != nil {
32 _, _ = fmt.Fprintf(os.Stderr, "%v\n%s", err, gdebug.StackWithFilter([]string{pathFilterKey}))
33 t.Fail()
34 }
35 }()
36 f(&T{t})
37}
38
39// Assert checks `value` and `expect` EQUAL.
40func Assert(value, expect any) {

Callers 15

Test_StringFunction · 0.92
Test_String_JSONFunction · 0.92
Test_InterfaceFunction · 0.92
Test_Interface_JSONFunction · 0.92
Test_Float64Function · 0.92
Test_Float64_JSONFunction · 0.92
Test_Float32Function · 0.92
Test_Float32_JSONFunction · 0.92

Calls 1

StackWithFilterFunction · 0.92

Tested by 15

Test_StringFunction · 0.74
Test_String_JSONFunction · 0.74
Test_InterfaceFunction · 0.74
Test_Interface_JSONFunction · 0.74
Test_Float64Function · 0.74
Test_Float64_JSONFunction · 0.74
Test_Float32Function · 0.74
Test_Float32_JSONFunction · 0.74