From 04740d302b85dfd0e23f3e833e3bb585333f7813 Mon Sep 17 00:00:00 2001 From: mstmdev Date: Thu, 30 Jun 2022 21:43:41 +0800 Subject: [PATCH] Fix assert arguments mistakes, swap expected and actual arguments --- context_test.go | 4 ++-- errors_test.go | 6 +++--- path_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/context_test.go b/context_test.go index 6c0be544..4e43e2b4 100644 --- a/context_test.go +++ b/context_test.go @@ -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) } diff --git a/errors_test.go b/errors_test.go index 78d561c6..aef69e18 100644 --- a/errors_test.go +++ b/errors_test.go @@ -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(), diff --git a/path_test.go b/path_test.go index caefd63a..254e95de 100644 --- a/path_test.go +++ b/path_test.go @@ -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) } }