@@ -10,7 +10,6 @@ import (
10
10
"github.com/rossmacarthur/fudge/errors"
11
11
"github.com/sebdah/goldie/v2"
12
12
"github.com/stretchr/testify/require"
13
- "google.golang.org/protobuf/encoding/protojson"
14
13
)
15
14
16
15
var errSentinel = errors .Sentinel ("such test" , "TEST1234" )
@@ -52,9 +51,9 @@ func TestFromProto(t *testing.T) {
52
51
Line : 1576 ,
53
52
},
54
53
{
55
- File : "runtime/asm_arm64 .s" ,
54
+ File : "runtime/asm_arch .s" ,
56
55
Function : "goexit" ,
57
- Line : 1172 ,
56
+ Line : 1337 ,
58
57
},
59
58
},
60
59
},
@@ -81,9 +80,9 @@ func TestFromProto(t *testing.T) {
81
80
Line : 1576 ,
82
81
},
83
82
{
84
- File : "runtime/asm_arm64 .s" ,
83
+ File : "runtime/asm_arch .s" ,
85
84
Function : "goexit" ,
86
- Line : 1172 ,
85
+ Line : 1337 ,
87
86
},
88
87
},
89
88
},
@@ -109,9 +108,9 @@ func TestFromProto(t *testing.T) {
109
108
Line : 1576 ,
110
109
},
111
110
{
112
- File : "runtime/asm_arm64 .s" ,
111
+ File : "runtime/asm_arch .s" ,
113
112
Function : "goexit" ,
114
- Line : 1172 ,
113
+ Line : 1337 ,
115
114
},
116
115
},
117
116
},
@@ -150,9 +149,9 @@ func TestFromProto(t *testing.T) {
150
149
Line : 1576 ,
151
150
},
152
151
{
153
- File : "runtime/asm_arm64 .s" ,
152
+ File : "runtime/asm_arch .s" ,
154
153
Function : "goexit" ,
155
- Line : 1172 ,
154
+ Line : 1337 ,
156
155
},
157
156
},
158
157
},
@@ -178,6 +177,12 @@ func TestFromProto(t *testing.T) {
178
177
}
179
178
180
179
func TestToProto (t * testing.T ) {
180
+ dummyFrame := & Frame {
181
+ File : "runtime/asm_arch.s" ,
182
+ Function : "goexit" ,
183
+ Line : 1337 ,
184
+ }
185
+
181
186
tests := []struct {
182
187
name string
183
188
errFn func () error
@@ -239,9 +244,12 @@ func TestToProto(t *testing.T) {
239
244
for _ , tt := range tests {
240
245
t .Run (tt .name , func (t * testing.T ) {
241
246
got := ToProto (tt .errFn ())
242
- bytes , err := protojson.MarshalOptions {Multiline : true }.Marshal (got )
243
- require .Nil (t , err )
244
- g .Assert (t , tt .name , bytes )
247
+ for _ , hop := range got .Hops {
248
+ if len (hop .Trace ) > 0 {
249
+ hop .Trace [len (hop .Trace )- 1 ] = dummyFrame
250
+ }
251
+ }
252
+ g .AssertJson (t , tt .name , got )
245
253
})
246
254
}
247
255
}
0 commit comments