File tree 1 file changed +5
-4
lines changed 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ package codes
20
20
21
21
import (
22
22
"encoding/json"
23
+ "errors"
23
24
"reflect"
24
25
"testing"
25
26
@@ -93,10 +94,10 @@ func (s) TestUnmarshalJSON_MarshalUnmarshal(t *testing.T) {
93
94
}
94
95
95
96
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
+
96
99
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 )
101
102
}
102
103
}
You can’t perform that action at this time.
0 commit comments