MCPcopy Create free account
hub / github.com/cogentcore/core / TestNodeJSON

Function TestNodeJSON

tree/io_test.go:33–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestNodeJSON(t *testing.T) {
34 parent := testNodeTree()
35
36 var buf bytes.Buffer
37 assert.NoError(t, jsonx.Write(&parent, &buf))
38 b := buf.Bytes()
39
40 testload := testdata.NewNodeEmbed()
41 if assert.NoError(t, jsonx.Read(&testload, bytes.NewReader(b))) {
42 assert.Equal(t, parent.Mbr1, testload.Mbr1)
43 assert.Equal(t, parent.Mbr2, testload.Mbr2)
44 var buf2 bytes.Buffer
45 assert.NoError(t, jsonx.Write(testload, &buf2))
46 tstb := buf2.Bytes()
47 assert.Equal(t, string(b), string(tstb))
48 }
49}
50
51func TestNodeRootJSON(t *testing.T) {
52 parent := testNodeTree()

Callers

nothing calls this directly

Calls 6

WriteFunction · 0.92
NewNodeEmbedFunction · 0.92
ReadFunction · 0.92
testNodeTreeFunction · 0.85
EqualMethod · 0.80
BytesMethod · 0.45

Tested by

no test coverage detected