Assert checks `value` and `expect` EQUAL.
(value, expect any)
| 38 | |
| 39 | // Assert checks `value` and `expect` EQUAL. |
| 40 | func 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. |
| 61 | func AssertEQ(value, expect any) { |
searching dependent graphs…