@@ -319,7 +319,7 @@ func TestInvalidTypeMarshal(t *testing.T) {
319
319
{"map of channel cannot be marshaled" , make (map [string ]chan bool ), "cbor: unsupported type: map[string]chan bool" },
320
320
{"struct of channel cannot be marshaled" , s1 {}, "cbor: unsupported type: cbor.s1" },
321
321
{"struct of channel cannot be marshaled" , s2 {}, "cbor: unsupported type: cbor.s2" },
322
- {"function cannot be marshaled" , func (i int ) int { return i * i }, "cbor: unsupported type: func(int) int " },
322
+ {"function cannot be marshaled" , func (i int ) int { return i * i }, "cbor: unsupported type: func" },
323
323
{"complex cannot be marshaled" , complex (100 , 8 ), "cbor: unsupported type: complex128" },
324
324
}
325
325
em , err := EncOptions {Sort : SortCanonical }.EncMode ()
@@ -334,7 +334,7 @@ func TestInvalidTypeMarshal(t *testing.T) {
334
334
t .Errorf ("Marshal(%v) didn't return an error, want error %q" , tc .value , tc .wantErrorMsg )
335
335
} else if _ , ok := err .(* UnsupportedTypeError ); ! ok {
336
336
t .Errorf ("Marshal(%v) error type %T, want *UnsupportedTypeError" , tc .value , err )
337
- } else if err .Error () != tc .wantErrorMsg {
337
+ } else if ! strings . HasPrefix ( err .Error (), tc .wantErrorMsg ) {
338
338
t .Errorf ("Marshal(%v) error %q, want %q" , tc .value , err .Error (), tc .wantErrorMsg )
339
339
} else if b != nil {
340
340
t .Errorf ("Marshal(%v) = 0x%x, want nil" , tc .value , b )
@@ -346,7 +346,7 @@ func TestInvalidTypeMarshal(t *testing.T) {
346
346
t .Errorf ("Marshal(%v) didn't return an error, want error %q" , tc .value , tc .wantErrorMsg )
347
347
} else if _ , ok := err .(* UnsupportedTypeError ); ! ok {
348
348
t .Errorf ("Marshal(%v) error type %T, want *UnsupportedTypeError" , tc .value , err )
349
- } else if err .Error () != tc .wantErrorMsg {
349
+ } else if ! strings . HasPrefix ( err .Error (), tc .wantErrorMsg ) {
350
350
t .Errorf ("Marshal(%v) error %q, want %q" , tc .value , err .Error (), tc .wantErrorMsg )
351
351
} else if b != nil {
352
352
t .Errorf ("Marshal(%v) = 0x%x, want nil" , tc .value , b )
0 commit comments