resolve tests: one stack-bound test per way a node nests
This commit is contained in:
parent
2fcd522516
commit
8571dd299a
1 changed files with 32 additions and 9 deletions
|
|
@ -938,16 +938,39 @@ fn a_chain_past_the_depth_rule_and_within_the_stack_bound_resolves_then_is_refus
|
|||
assert!(!too_deep_to_resolve(&resolution), "{:?}", resolution.diagnostics);
|
||||
}
|
||||
|
||||
/// 1,024 levels is the deepest the expander recurses into (the depth rule refuses such a tree
|
||||
/// later); one more is `TooDeepToResolve`, whichever way the levels nest.
|
||||
fn stack_bound_counts(through: Through) {
|
||||
let at_bound = resolve_nested(1024, through);
|
||||
assert!(!too_deep_to_resolve(&at_bound), "{through:?}: {:?}", at_bound.diagnostics);
|
||||
let past = resolve_nested(1025, through);
|
||||
assert!(past.tree.is_none(), "{through:?}");
|
||||
assert!(too_deep_to_resolve(&past), "{through:?}: {:?}", past.diagnostics);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_bound_counts_every_way_a_node_nests_and_refuses_at_the_next_level() {
|
||||
for through in [Through::BoxChildren, Through::RepeatTemplate, Through::ButtonContent, Through::OverlayChildren, Through::SlotArgument] {
|
||||
// 1,024 levels is the deepest the expander recurses into; the depth rule refuses it later.
|
||||
let at_bound = resolve_nested(1024, through);
|
||||
assert!(!too_deep_to_resolve(&at_bound), "{through:?}: {:?}", at_bound.diagnostics);
|
||||
let past = resolve_nested(1025, through);
|
||||
assert!(past.tree.is_none(), "{through:?}");
|
||||
assert!(too_deep_to_resolve(&past), "{through:?}: {:?}", past.diagnostics);
|
||||
}
|
||||
fn the_stack_bound_counts_box_children() {
|
||||
stack_bound_counts(Through::BoxChildren);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_bound_counts_a_repeat_template() {
|
||||
stack_bound_counts(Through::RepeatTemplate);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_bound_counts_button_content() {
|
||||
stack_bound_counts(Through::ButtonContent);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_bound_counts_overlay_children() {
|
||||
stack_bound_counts(Through::OverlayChildren);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_bound_counts_a_slot_argument() {
|
||||
stack_bound_counts(Through::SlotArgument);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue