Atlas › Test

TestDecode

Exact test identity: go.temporal.io/server/common/codec/TestJSONPBEncoderSuite/TestDecode

Package
go.temporal.io/server/common/codec
Suite / test hierarchy
TestJSONPBEncoderSuite/TestDecode
Test
TestDecode
Introduced at
TestDecode Frontier kind: Test frontier
Covered ranges
4
Covered lines
12
Covered files
2

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/codec/jsonpb.go 6 covered LOC · 2 ranges

Open complete file

23
24 // NewJSONPBEncoder creates a new JSONPBEncoder.
25 > func NewJSONPBEncoder() JSONPBEncoder { jsonpb.go
26 > return JSONPBEncoder{}
27 > }
28
29 // NewJSONPBIndentEncoder creates a new JSONPBEncoder with indent.
42
43 // Decode bytes to protobuf struct.
44 > func (e JSONPBEncoder) Decode(data []byte, pb proto.Message) error { jsonpb.go
45 > return e.unmarshaler.Unmarshal(data, pb)
46 > }
47
48 // Encode HistoryEvent slice to bytes.
go.temporal.io/server/common/testing/protoassert/assert.go 6 covered LOC · 2 ranges

Open complete file

25
26 // ProtoEqual compares two proto.Message objects for equality
27 > func ProtoEqual(t assert.TestingT, a proto.Message, b proto.Message) bool { assert.go
28 > if th, ok := t.(helper); ok {
29 > th.Helper()
30 > }
31 > if diff := cmp.Diff(a, b, protocmp.Transform()); diff != "" {
32 return assert.Fail(t, fmt.Sprintf("Proto mismatch (-want +got):\n%v", diff))
33 }
34 > return true assert.go
35 }
36