Schedule sibling inheritance by dependency readiness
This commit is contained in:
@@ -110,6 +110,41 @@ beta:
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritanceExpansionInterleavesUnequalBranches(t *testing.T) {
|
||||
root := parseCompositionDocument(t, "branches", `a-grandchild:
|
||||
extends: z-child
|
||||
own: grandchild
|
||||
b-base:
|
||||
base: b
|
||||
c-base:
|
||||
base: c
|
||||
d-child:
|
||||
extends: c-base
|
||||
own: d
|
||||
z-child:
|
||||
extends: b-base
|
||||
own: z
|
||||
`)
|
||||
result, diagnostics := expandInheritanceTree(root, defaultProjectionLimits())
|
||||
if len(diagnostics) != 0 {
|
||||
t.Fatalf("expand diagnostics = %#v", diagnostics)
|
||||
}
|
||||
got := make([]string, len(result.transfers))
|
||||
for i, transfer := range result.transfers {
|
||||
got[i] = transfer.from.String() + " -> " + transfer.to.String()
|
||||
}
|
||||
want := []string{"/c-base -> /d-child", "/b-base -> /z-child", "/z-child -> /a-grandchild"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("transfer order = %v, want %v", got, want)
|
||||
}
|
||||
if value, found := documentAtPath(result.root, Path{}.Key("a-grandchild").Key("base")); !found || value.Text != "b" {
|
||||
t.Fatalf("grandchild inherited value = %#v, found %t", value, found)
|
||||
}
|
||||
if value, found := documentAtPath(result.root, Path{}.Key("d-child").Key("base")); !found || value.Text != "c" {
|
||||
t.Fatalf("independent branch inherited value = %#v, found %t", value, found)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritanceGraphValidatesRelationshipKinds(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user