File tree 1 file changed +8
-6
lines changed
internal/telemetry/export/ocagent 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 5
5
package ocagent_test
6
6
7
7
import (
8
+ "bytes"
8
9
"context"
9
10
"encoding/json"
10
11
"errors"
11
- "reflect"
12
12
"testing"
13
13
14
14
"golang.org/x/tools/internal/telemetry"
@@ -207,18 +207,20 @@ func TestConvert_annotation(t *testing.T) {
207
207
checkJSON (t , got , []byte (tt .want ))
208
208
})
209
209
}
210
+
210
211
}
211
212
212
213
func checkJSON (t * testing.T , got , want []byte ) {
213
- // compare the decoded form, to allow for formatting differences
214
- var g , w map [ string ] interface {}
215
- if err := json .Unmarshal ( got , & g ); err != nil {
214
+ // compare the compact form, to allow for formatting differences
215
+ g := & bytes. Buffer {}
216
+ if err := json .Compact ( g , got ); err != nil {
216
217
t .Fatal (err )
217
218
}
218
- if err := json .Unmarshal (want , & w ); err != nil {
219
+ w := & bytes.Buffer {}
220
+ if err := json .Compact (w , want ); err != nil {
219
221
t .Fatal (err )
220
222
}
221
- if ! reflect . DeepEqual ( g , w ) {
223
+ if g . String () != w . String ( ) {
222
224
t .Fatalf ("Got:\n %s\n Want:\n %s" , got , want )
223
225
}
224
226
}
You can’t perform that action at this time.
0 commit comments