@@ -48,8 +48,10 @@ var testDefs = []struct {
4848 },
4949 // Invalid map key type
5050 {
51- cborHex : "A1810000" ,
52- expectedDecodeError : fmt .Errorf ("decode failure, probably due to type unsupported by Go: runtime error: hash of unhashable type []interface {}" ),
51+ cborHex : "A1810000" ,
52+ expectedDecodeError : fmt .Errorf (
53+ "decode failure, probably due to type unsupported by Go: runtime error: hash of unhashable type []interface {}" ,
54+ ),
5355 },
5456 // [1, 2, 3]
5557 {
@@ -59,8 +61,11 @@ var testDefs = []struct {
5961 },
6062 // {1: 2, 3: 4}
6163 {
62- cborHex : "A201020304" ,
63- expectedObject : map [any ]any {uint64 (1 ): uint64 (2 ), uint64 (3 ): uint64 (4 )},
64+ cborHex : "A201020304" ,
65+ expectedObject : map [any ]any {
66+ uint64 (1 ): uint64 (2 ),
67+ uint64 (3 ): uint64 (4 ),
68+ },
6469 expectedAstJson : `{"map":[{"k":{"int":1},"v":{"int":2}},{"k":{"int":3},"v":{"int":4}}]}` ,
6570 },
6671 // {1: [2], 3: [4]}
@@ -93,7 +98,11 @@ func TestValueDecode(t *testing.T) {
9398 if _ , err := cbor .Decode (cborData , & tmpValue ); err != nil {
9499 if testDef .expectedDecodeError != nil {
95100 if err .Error () != testDef .expectedDecodeError .Error () {
96- t .Fatalf ("did not receive expected decode error, got: %s, wanted: %s" , err , testDef .expectedDecodeError )
101+ t .Fatalf (
102+ "did not receive expected decode error, got: %s, wanted: %s" ,
103+ err ,
104+ testDef .expectedDecodeError ,
105+ )
97106 }
98107 continue
99108 } else {
@@ -106,7 +115,11 @@ func TestValueDecode(t *testing.T) {
106115 }
107116 newObj := tmpValue .Value ()
108117 if ! reflect .DeepEqual (newObj , testDef .expectedObject ) {
109- t .Fatalf ("CBOR did not decode to expected object\n got: %#v\n wanted: %#v" , newObj , testDef .expectedObject )
118+ t .Fatalf (
119+ "CBOR did not decode to expected object\n got: %#v\n wanted: %#v" ,
120+ newObj ,
121+ testDef .expectedObject ,
122+ )
110123 }
111124 }
112125}
@@ -142,7 +155,11 @@ func TestValueMarshalJSON(t *testing.T) {
142155 )
143156 }
144157 if ! test .JsonStringsEqual (jsonData , []byte (fullExpectedJson )) {
145- t .Fatalf ("CBOR did not marshal to expected JSON\n got: %s\n wanted: %s" , jsonData , fullExpectedJson )
158+ t .Fatalf (
159+ "CBOR did not marshal to expected JSON\n got: %s\n wanted: %s" ,
160+ jsonData ,
161+ fullExpectedJson ,
162+ )
146163 }
147164 }
148165}
@@ -157,7 +174,11 @@ func TestLazyValueDecode(t *testing.T) {
157174 if _ , err := cbor .Decode (cborData , & tmpValue ); err != nil {
158175 if testDef .expectedDecodeError != nil {
159176 if err .Error () != testDef .expectedDecodeError .Error () {
160- t .Fatalf ("did not receive expected decode error, got: %s, wanted: %s" , err , testDef .expectedDecodeError )
177+ t .Fatalf (
178+ "did not receive expected decode error, got: %s, wanted: %s" ,
179+ err ,
180+ testDef .expectedDecodeError ,
181+ )
161182 }
162183 continue
163184 } else {
@@ -168,7 +189,11 @@ func TestLazyValueDecode(t *testing.T) {
168189 if err != nil {
169190 if testDef .expectedDecodeError != nil {
170191 if err .Error () != testDef .expectedDecodeError .Error () {
171- t .Fatalf ("did not receive expected decode error, got: %s, wanted: %s" , err , testDef .expectedDecodeError )
192+ t .Fatalf (
193+ "did not receive expected decode error, got: %s, wanted: %s" ,
194+ err ,
195+ testDef .expectedDecodeError ,
196+ )
172197 }
173198 continue
174199 } else {
@@ -180,7 +205,11 @@ func TestLazyValueDecode(t *testing.T) {
180205 }
181206 }
182207 if ! reflect .DeepEqual (newObj , testDef .expectedObject ) {
183- t .Fatalf ("CBOR did not decode to expected object\n got: %#v\n wanted: %#v" , newObj , testDef .expectedObject )
208+ t .Fatalf (
209+ "CBOR did not decode to expected object\n got: %#v\n wanted: %#v" ,
210+ newObj ,
211+ testDef .expectedObject ,
212+ )
184213 }
185214 }
186215}
@@ -216,7 +245,11 @@ func TestLazyValueMarshalJSON(t *testing.T) {
216245 )
217246 }
218247 if ! test .JsonStringsEqual (jsonData , []byte (fullExpectedJson )) {
219- t .Fatalf ("CBOR did not marshal to expected JSON\n got: %s\n wanted: %s" , jsonData , fullExpectedJson )
248+ t .Fatalf (
249+ "CBOR did not marshal to expected JSON\n got: %s\n wanted: %s" ,
250+ jsonData ,
251+ fullExpectedJson ,
252+ )
220253 }
221254 }
222255}
0 commit comments