Fix assert arguments mistakes, swap expected and actual arguments

This commit is contained in:
mstmdev 2022-06-30 21:43:41 +08:00
parent 92dd245c9b
commit 04740d302b
3 changed files with 6 additions and 6 deletions

View File

@ -147,7 +147,7 @@ func TestSaveUploadedCreateFailed(t *testing.T) {
func TestContextReset(t *testing.T) {
router := New()
c := router.allocateContext()
assert.Equal(t, c.engine, router)
assert.Equal(t, router, c.engine)
c.index = 2
c.Writer = &responseWriter{ResponseWriter: httptest.NewRecorder()}
@ -163,7 +163,7 @@ func TestContextReset(t *testing.T) {
assert.Empty(t, c.Errors.Errors())
assert.Empty(t, c.Errors.ByType(ErrorTypeAny))
assert.Len(t, c.Params, 0)
assert.EqualValues(t, c.index, -1)
assert.EqualValues(t, -1, c.index)
assert.Equal(t, c.Writer.(*responseWriter), &c.writermem)
}

View File

@ -19,13 +19,13 @@ func TestError(t *testing.T) {
Err: baseError,
Type: ErrorTypePrivate,
}
assert.Equal(t, err.Error(), baseError.Error())
assert.Equal(t, baseError.Error(), err.Error())
assert.Equal(t, H{"error": baseError.Error()}, err.JSON())
assert.Equal(t, err.SetType(ErrorTypePublic), err)
assert.Equal(t, err, err.SetType(ErrorTypePublic))
assert.Equal(t, ErrorTypePublic, err.Type)
assert.Equal(t, err.SetMeta("some data"), err)
assert.Equal(t, err, err.SetMeta("some data"))
assert.Equal(t, "some data", err.Meta)
assert.Equal(t, H{
"error": baseError.Error(),

View File

@ -82,7 +82,7 @@ func TestPathCleanMallocs(t *testing.T) {
for _, test := range cleanTests {
allocs := testing.AllocsPerRun(100, func() { cleanPath(test.result) })
assert.EqualValues(t, allocs, 0)
assert.EqualValues(t, 0, allocs)
}
}