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

Function TestNodeWalkPath

tree/node_test.go:278–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

276}
277
278func TestNodeWalkPath(t *testing.T) {
279 parent := NewNodeBase()
280 testdata.NewNodeEmbed(parent).SetName("child0")
281 child1 := NewNodeBase(parent).SetName("child1")
282 testdata.NewNodeEmbed(parent).SetName("child2")
283 testdata.NewNodeEmbed(child1).SetName("subchild1")
284 NewNodeBase(parent).SetName("child3")
285
286 res := []string{}
287
288 parent.WalkDown(func(n Node) bool {
289 res = append(res, n.AsTree().Path())
290 return Continue
291 })
292 assert.Equal(t, []string{"/node-base", "/node-base/child0", "/node-base/child1", "/node-base/child1/subchild1", "/node-base/child2", "/node-base/child3"}, res)
293}
294
295func TestProperties(t *testing.T) {
296 n := testdata.NewNodeEmbed()

Callers

nothing calls this directly

Calls 7

WalkDownMethod · 0.95
NewNodeEmbedFunction · 0.92
EqualMethod · 0.80
NewNodeBaseFunction · 0.70
SetNameMethod · 0.65
AsTreeMethod · 0.65
PathMethod · 0.45

Tested by

no test coverage detected