Skip to content

Commit

Permalink
Fix for the linter checks
Browse files Browse the repository at this point in the history
  • Loading branch information
WilsonRadadia20 committed Feb 5, 2025
1 parent 291c902 commit d6bb6dc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions api/json/json_encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ func TestBoolEncoder(t *testing.T) {
e.Reset()
}

func TestInvalidUTF8Error(t *testing.T) {
func TestInvalidUTF8Error(_ *testing.T) {
err := InvalidUTF8Error{}
_ = err.Error()
}
Expand All @@ -881,7 +881,7 @@ func TestMarshalerError(t *testing.T) {
assert.Equal(t, expected, result)
}

func TestUnsupportedValueError(t *testing.T) {
func TestUnsupportedValueError(_ *testing.T) {
err := UnsupportedValueError{}
_ = err.Error()
}
Expand Down Expand Up @@ -933,7 +933,7 @@ func TestUintEncoder(t *testing.T) {
e.Reset()
}

func TestEncodefloatEncoder(t *testing.T) {
func TestEncodefloatEncoder(_ *testing.T) {
var e encodeState
encoder := floatEncoder(64)

Expand All @@ -951,7 +951,7 @@ func TestSliceEncoder(t *testing.T) {
name: "Handle nil slice",
value: ([]int)(nil),
expectedString: "null",
arrayEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
arrayEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
// This should not be called for nil slice
t.Fail()
},
Expand All @@ -960,7 +960,7 @@ func TestSliceEncoder(t *testing.T) {
name: "Handle non-nil slice",
value: []int{1, 2, 3},
expectedString: "[1,2,3]",
arrayEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
arrayEnc: func(e *encodeState, _ reflect.Value, _ encOpts) {
// Simulate encoding of a non-nil slice
_, _ = e.WriteString("[1,2,3]")
},
Expand Down Expand Up @@ -997,7 +997,7 @@ func TestPtrEncoder(t *testing.T) {
name: "Handle nil pointer",
value: (*int)(nil),
expectedString: "null",
elemEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
elemEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
// This should not be called for nil pointer
t.Fail()
},
Expand All @@ -1006,7 +1006,7 @@ func TestPtrEncoder(t *testing.T) {
name: "Handle non-nil pointer",
value: func() *int { i := 42; return &i }(),
expectedString: "42",
elemEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
elemEnc: func(e *encodeState, _ reflect.Value, _ encOpts) {
// Simulate encoding of a non-nil pointer
_, _ = e.WriteString("42")
},
Expand Down Expand Up @@ -1043,25 +1043,25 @@ func TestCondAddrEncoder_Encode(t *testing.T) {
{
name: "Test case for value with CanAddr() == true",
value: "test",
canAddrEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
canAddrEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
},
elseEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
elseEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
},
expectedString: "expected string for value with CanAddr() == true",
},
{
name: "Test case for value with CanAddr() == false",
value: "test",
canAddrEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
canAddrEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
},
elseEnc: func(e *encodeState, v reflect.Value, opts encOpts) {
elseEnc: func(_ *encodeState, _ reflect.Value, _ encOpts) {
},
expectedString: "expected string for value with CanAddr() == false",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
e := &encodeState{}

ce := &condAddrEncoder{
Expand Down

0 comments on commit d6bb6dc

Please sign in to comment.