Fix nested inheritance history and budget accounting
This commit is contained in:
@@ -194,3 +194,26 @@ func TestInheritanceExpansionHonorsOutputNodeAndDepthBudgets(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritanceBudgetIncludesOtherScopesAndSequenceItems(t *testing.T) {
|
||||
input := parseCompositionDocument(t, "source-1", `extends: null
|
||||
groups:
|
||||
- a: {x: one}
|
||||
b: {extends: a}
|
||||
- a: {x: two}
|
||||
b: {extends: a}
|
||||
unchanged: {x: three}
|
||||
`)
|
||||
// Root (1), groups key/list (2), two expanded scopes (18), and
|
||||
// unchanged key/mapping/key/value (4). Consumed controls cost nothing.
|
||||
for _, limit := range []int{24, 25, 26} {
|
||||
result, diagnostics := expandInheritanceTree(input, projectionLimits{nodes: limit, depth: 5})
|
||||
if limit < 25 {
|
||||
if result != nil || len(diagnostics) != 1 || diagnostics[0].Code != CodeSchemaProjectionLimit {
|
||||
t.Fatalf("limit %d accepted or wrong error: %#v", limit, diagnostics)
|
||||
}
|
||||
} else if result == nil || len(diagnostics) != 0 {
|
||||
t.Fatalf("limit %d rejected: %#v", limit, diagnostics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user