(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func 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 | |
| 295 | func TestProperties(t *testing.T) { |
| 296 | n := testdata.NewNodeEmbed() |
nothing calls this directly
no test coverage detected