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

Function Assert

test/gtest/gtest_util.go:40–58  ·  view source on GitHub ↗

Assert checks `value` and `expect` EQUAL.

(value, expect any)

Source from the content-addressed store, hash-verified

38
39// Assert checks `value` and `expect` EQUAL.
40func Assert(value, expect any) {
41 rvExpect := reflect.ValueOf(expect)
42 if empty.IsNil(value) {
43 value = nil
44 }
45 if rvExpect.Kind() == reflect.Map {
46 if err := compareMap(value, expect); err != nil {
47 panic(err)
48 }
49 return
50 }
51 var (
52 strValue = gconv.String(value)
53 strExpect = gconv.String(expect)
54 )
55 if strValue != strExpect {
56 panic(fmt.Sprintf(`[ASSERT] EXPECT %v == %v`, strValue, strExpect))
57 }
58}
59
60// AssertEQ checks `value` and `expect` EQUAL, including their TYPES.
61func AssertEQ(value, expect any) {

Callers 15

Test_DB_TableFieldFunction · 0.92
createInitTableWithDbFunction · 0.92
Test_Model_AllAndCountFunction · 0.92
Test_Model_FieldsFunction · 0.92
Test_Model_ScanAndCountFunction · 0.92
Test_Model_Issue1002Function · 0.92
TestTablesFalseFunction · 0.92
TestTableFieldsFunction · 0.92
Test_Model_InsertFunction · 0.92
createInitTableFunction · 0.92
Test_DB_ReplaceFunction · 0.92

Calls 4

IsNilFunction · 0.92
StringFunction · 0.92
compareMapFunction · 0.85
KindMethod · 0.80

Tested by 15

Test_DB_TableFieldFunction · 0.74
createInitTableWithDbFunction · 0.74
Test_Model_AllAndCountFunction · 0.74
Test_Model_FieldsFunction · 0.74
Test_Model_ScanAndCountFunction · 0.74
Test_Model_Issue1002Function · 0.74
TestTablesFalseFunction · 0.74
TestTableFieldsFunction · 0.74
Test_Model_InsertFunction · 0.74
createInitTableFunction · 0.74
Test_DB_ReplaceFunction · 0.74
createInitTableWithDbFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…