Equal asserts that a and b are equal. func Test(t *testing.T) { is := is.New(t) a := greet("Mat") is.Equal(a, "Hi Mat") // greeting } Will output: your_test.go:123: Hey Mat != Hi Mat // greeting
(a interface{}, b interface{}, args ...interface{})
| 30 | // |
| 31 | // your_test.go:123: Hey Mat != Hi Mat // greeting |
| 32 | func (is *I) Equal(a interface{}, b interface{}, args ...interface{}) { |
| 33 | if areEqual(a, b) { |
| 34 | return |
| 35 | } |
| 36 | if isNil(a) || isNil(b) { |
| 37 | is.logf("%s != %s%s", is.valWithType(a), is.valWithType(b), is.formatArgs(args)) |
| 38 | } else if reflect.ValueOf(a).Type() == reflect.ValueOf(b).Type() { |
| 39 | is.logf("%v != %v%s", a, b, is.formatArgs(args)) |
| 40 | } else { |
| 41 | is.logf("%s != %s%s", is.valWithType(a), is.valWithType(b), is.formatArgs(args)) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // NoErr asserts that err is nil. |
| 46 | // |