add assert tests
This commit is contained in:
30
test/assert/equal.go
Normal file
30
test/assert/equal.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Equal(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
|
||||
t.Helper()
|
||||
|
||||
if reflect.DeepEqual(expected, actual) {
|
||||
return true
|
||||
}
|
||||
|
||||
t.Error(msgAndArgs...)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func Equalf(t *testing.T, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
|
||||
t.Helper()
|
||||
|
||||
if reflect.DeepEqual(expected, actual) {
|
||||
return true
|
||||
}
|
||||
|
||||
t.Errorf(msg, args...)
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user