pub struct TestDef {
pub name: Arc<str>,
pub params: Vec<(VarId, Arc<str>, Ty)>,
pub clauses: Vec<Clause>,
pub bindings: Bindings,
pub span: Span,
}Expand description
A checked test or property block.
Fields§
§name: Arc<str>§params: Vec<(VarId, Arc<str>, Ty)>Non-empty for a property: the inputs a generator supplies (§21.3 rule 5).
clauses: Vec<Clause>§bindings: BindingsThe variables state, events and result are bound to while the expectations run.
span: SpanImplementations§
Source§impl TestDef
impl TestDef
pub fn is_property(&self) -> bool
Sourcepub fn cores(&self) -> Vec<&Core>
pub fn cores(&self) -> Vec<&Core>
Every expression this test evaluates, to be read rather than rewritten.
Editor::references is what wants them: a name used
only inside a test block is used, and an editor that did not look here would report it as
unreferenced and rename it into a program that no longer compiles.
This and cores_mut have to stay the same list — the failure this
file has already had once is a pass that walked Program::defs and missed every expression
in a test block — so tests::the_two_walks_agree counts them
against each other.
Sourcepub fn cores_mut(&mut self) -> Vec<&mut Core>
pub fn cores_mut(&mut self) -> Vec<&mut Core>
Every expression this test evaluates, to be annotated in place.
A test block’s expressions are code, and the three passes that annotate a finished
program — crate::liveness, crate::frames and crate::fields — reach them through
here. They did not until 70: all three
walked Program::defs, a test’s clauses are not in it, and so every expression inside a
test block ran on the paths those passes exist to replace.
A clause that names something rather than computing it — expect place(charge) == server,
expect no net.out — contributes nothing, because there is no expression to annotate.
Sourcepub fn clause_spans(&self) -> impl Iterator<Item = Span> + '_
pub fn clause_spans(&self) -> impl Iterator<Item = Span> + '_
Every clause’s span, so a caller can ask what part of the file a clause covers.
Sourcepub fn is_static_only(&self) -> bool
pub fn is_static_only(&self) -> bool
Every assertion that needs no execution — placement, flow, wire compatibility.
§21.2: “These are compile-time queries, not runtime assertions — beck test answers them
without running anything, from the same data beck explain place and beck check --wire-compat already produce.”