5
5
"context"
6
6
"encoding/json"
7
7
"encoding/xml"
8
- "io/ioutil "
8
+ "os "
9
9
"testing"
10
10
)
11
11
@@ -237,11 +237,13 @@ func TestChange_HistoryDatasource(t *testing.T) {
237
237
}
238
238
239
239
func BenchmarkChange_MarshalXML (b * testing.B ) {
240
- filename := "testdata/changeset_38162206.osc"
241
- data := readFile (b , filename )
240
+ data , err := os .ReadFile ("testdata/changeset_38162206.osc" )
241
+ if err != nil {
242
+ b .Fatalf ("unable to read file: %v" , err )
243
+ }
242
244
243
245
c := & Change {}
244
- err : = xml .Unmarshal (data , c )
246
+ err = xml .Unmarshal (data , c )
245
247
if err != nil {
246
248
b .Fatalf ("unable to unmarshal: %v" , err )
247
249
}
@@ -270,7 +272,7 @@ func BenchmarkChange_MarshalXML(b *testing.B) {
270
272
// }
271
273
272
274
func BenchmarkChange_MarshalJSON (b * testing.B ) {
273
- data , err := ioutil .ReadFile ("testdata/minute_871.osc" )
275
+ data , err := os .ReadFile ("testdata/minute_871.osc" )
274
276
if err != nil {
275
277
b .Fatalf ("could not read file: %v" , err )
276
278
}
@@ -292,7 +294,7 @@ func BenchmarkChange_MarshalJSON(b *testing.B) {
292
294
}
293
295
294
296
func BenchmarkChange_UnmarshalJSON (b * testing.B ) {
295
- data , err := ioutil .ReadFile ("testdata/minute_871.osc" )
297
+ data , err := os .ReadFile ("testdata/minute_871.osc" )
296
298
if err != nil {
297
299
b .Fatalf ("could not read file: %v" , err )
298
300
}
@@ -320,8 +322,10 @@ func BenchmarkChange_UnmarshalJSON(b *testing.B) {
320
322
}
321
323
322
324
func BenchmarkChangeset_UnmarshalXML (b * testing.B ) {
323
- filename := "testdata/changeset_38162206.osc"
324
- data := readFile (b , filename )
325
+ data , err := os .ReadFile ("testdata/changeset_38162206.osc" )
326
+ if err != nil {
327
+ b .Fatalf ("unable to read file: %v" , err )
328
+ }
325
329
326
330
b .ReportAllocs ()
327
331
b .ResetTimer ()
0 commit comments