TestRemoveChild tests removing a child
(t *testing.T)
| 402 | |
| 403 | // TestRemoveChild tests removing a child |
| 404 | func TestRemoveChild(t *testing.T) { |
| 405 | parent := NewBasic() |
| 406 | children := NewBasics(3) |
| 407 | parent.AppendChild(&children[0]) |
| 408 | parent.AppendChild(&children[1]) |
| 409 | parent.AppendChild(&children[2]) |
| 410 | if len(parent.Children()) != 3 { |
| 411 | t.Errorf("Parent did not successfully add all three children.") |
| 412 | } |
| 413 | parent.RemoveChild(&children[1]) |
| 414 | if len(parent.Children()) != 2 { |
| 415 | t.Errorf("Parent didd not successfully remove a child") |
| 416 | } |
| 417 | for i := 0; i < 2; i++ { |
| 418 | if children[1].ID() == parent.Children()[i].ID() { |
| 419 | t.Errorf("Found removed child in parent still") |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | func TestDescendents(t *testing.T) { |
| 425 | parent := NewBasic() |
nothing calls this directly
no test coverage detected
searching dependent graphs…