MCPcopy Create free account
hub / github.com/buger/jsonparser / TestAppendRoundTrip

Function TestAppendRoundTrip

append_test.go:95–111  ·  view source on GitHub ↗

Verifies: SYS-REQ-110 (Set/array append) reqproof:proptest:skip

(t *testing.T)

Source from the content-addressed store, hash-verified

93// Verifies: SYS-REQ-110 (Set/array append)
94// reqproof:proptest:skip
95func TestAppendRoundTrip(t *testing.T) {
96 got, err := Append([]byte(`[1,2]`), []byte(`{"id":3}`))
97 if err != nil {
98 t.Fatalf("Append returned error: %v", err)
99 }
100
101 last, dataType, _, err := Get(got, "[2]")
102 if err != nil {
103 t.Fatalf("Get appended value returned error: %v", err)
104 }
105 if dataType != Object {
106 t.Fatalf("Get appended value type = %v, want %v", dataType, Object)
107 }
108 if want := `{"id":3}`; string(last) != want {
109 t.Fatalf("Get appended value = %s, want %s", last, want)
110 }
111}
112
113// Verifies: SYS-REQ-110 (Set/array append)
114// reqproof:proptest:skip

Callers

nothing calls this directly

Calls 2

AppendFunction · 0.85
GetFunction · 0.85

Tested by

no test coverage detected