Skip to content

Commit a6f25ed

Browse files
committed
Resolving style comments by Easwar
1 parent 8eb5431 commit a6f25ed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

codes/codes_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package codes
2020

2121
import (
2222
"encoding/json"
23+
"errors"
2324
"reflect"
2425
"testing"
2526

@@ -93,10 +94,10 @@ func (s) TestUnmarshalJSON_MarshalUnmarshal(t *testing.T) {
9394
}
9495

9596
func (s) TestUnmarshalJSON_InvalidIntegerCode(t *testing.T) {
97+
wantErr := errors.New("invalid code: 200") // for integer invalid code, expect integer value in error message
98+
9699
var got Code
97-
wantErr := "invalid code: 200" // for integer invalid code, expect integer value in error message
98-
err := got.UnmarshalJSON([]byte("200"))
99-
if err.Error() != wantErr {
100-
t.Errorf("got.UnmarshalJSON(200) != %s; got=%s", wantErr, err.Error())
100+
if err := got.UnmarshalJSON([]byte("200")); wantErr.Error() != err.Error() {
101+
t.Errorf("got.UnmarshalJSON(200) != %v; wantErr: %v", err, wantErr)
101102
}
102103
}

0 commit comments

Comments
 (0)