From 6b474cb667cbdc03ab0adf89ad87396086fc33a0 Mon Sep 17 00:00:00 2001 From: Benjamin DENEUX Date: Mon, 29 Jul 2024 14:43:24 +0200 Subject: [PATCH] chore: fix linter import --- x/logic/keeper/grpc_query_ask_test.go | 1 + x/logic/util/pointer.go | 3 ++- x/logic/util/pointer_test.go | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/x/logic/keeper/grpc_query_ask_test.go b/x/logic/keeper/grpc_query_ask_test.go index db100307..76d1042a 100644 --- a/x/logic/keeper/grpc_query_ask_test.go +++ b/x/logic/keeper/grpc_query_ask_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/golang/mock/gomock" + . "github.com/smartystreets/goconvey/convey" sdkmath "cosmossdk.io/math" diff --git a/x/logic/util/pointer.go b/x/logic/util/pointer.go index 0f9c5c34..bfc29541 100644 --- a/x/logic/util/pointer.go +++ b/x/logic/util/pointer.go @@ -1,8 +1,9 @@ package util import ( - sdkmath "cosmossdk.io/math" "reflect" + + sdkmath "cosmossdk.io/math" ) // DerefOrDefault returns the value of the pointer if it is not nil, otherwise returns the default value. diff --git a/x/logic/util/pointer_test.go b/x/logic/util/pointer_test.go index d23607d8..350b0cd5 100644 --- a/x/logic/util/pointer_test.go +++ b/x/logic/util/pointer_test.go @@ -1,11 +1,12 @@ package util import ( - sdkmath "cosmossdk.io/math" "fmt" "testing" . "github.com/smartystreets/goconvey/convey" + + sdkmath "cosmossdk.io/math" ) func TestDerefOrDefault(t *testing.T) { @@ -63,8 +64,16 @@ func TestNonZeroOrDefaultUInt(t *testing.T) { expected sdkmath.Uint }{ {nil, sdkmath.ZeroUint(), sdkmath.ZeroUint()}, - {v: func() *sdkmath.Uint { u := sdkmath.ZeroUint(); return &u }(), defaultValue: sdkmath.NewUint(10), expected: sdkmath.NewUint(10)}, - {v: func() *sdkmath.Uint { u := sdkmath.NewUint(1); return &u }(), defaultValue: sdkmath.ZeroUint(), expected: sdkmath.NewUint(1)}, + { + func() *sdkmath.Uint { u := sdkmath.ZeroUint(); return &u }(), + sdkmath.NewUint(10), + sdkmath.NewUint(10), + }, + { + func() *sdkmath.Uint { u := sdkmath.NewUint(1); return &u }(), + sdkmath.ZeroUint(), + sdkmath.NewUint(1), + }, } for _, tc := range cases { Convey(fmt.Sprintf("When the value is %v", tc.v), func() {