1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

refactor: rewrite all unit test functions with assert

This commit is contained in:
dudaodong
2022-01-09 13:07:49 +08:00
parent 73f4ae7b35
commit 3438f3b18a
3 changed files with 179 additions and 332 deletions

View File

@@ -3,6 +3,7 @@ package internal
import (
"fmt"
"reflect"
"runtime"
"testing"
)
@@ -142,7 +143,8 @@ func compare(x, y interface{}) int {
// logFailedInfo make test failed and log error info
func logFailedInfo(t *testing.T, caseName string, expected, actual interface{}) {
errInfo := fmt.Sprintf("Test case %v: expected: %v, actual: %v", caseName, expected, actual)
_, file, line, _ := runtime.Caller(2)
errInfo := fmt.Sprintf("Case %v failed. file: %v, line: %v, expected: %v, actual: %v.", caseName, file, line, expected, actual)
t.Error(errInfo)
t.FailNow()
}