MCPcopy
hub / github.com/pquerna/ffjson / TestSimpleUnmarshal

Function TestSimpleUnmarshal

tests/ff_test.go:221–240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

219}
220
221func TestSimpleUnmarshal(t *testing.T) {
222 record := newLogFFRecord()
223
224 err := record.UnmarshalJSON([]byte(`{"id": 123213, "OriginID": 22, "meth": "GET"}`))
225 if err != nil {
226 t.Fatalf("UnmarshalJSON: %v", err)
227 }
228
229 if record.Timestamp != 123213 {
230 t.Fatalf("record.Timestamp: expected: 0 got: %v", record.Timestamp)
231 }
232
233 if record.OriginID != 22 {
234 t.Fatalf("record.OriginID: expected: 22 got: %v", record.OriginID)
235 }
236
237 if record.Method != "GET" {
238 t.Fatalf("record.Method: expected: GET got: %v", record.Method)
239 }
240}
241
242type marshalerFaster interface {
243 MarshalJSONBuf(buf fflib.EncodingBuffer) error

Callers

nothing calls this directly

Calls 3

newLogFFRecordFunction · 0.85
FatalfMethod · 0.65
UnmarshalJSONMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…