Expand description
English rendering of imperative expressions — the shared surface behind power-assert failure messages, property counterexamples, and mutation survivor reports.
render_expr turns an Expr back into source-like English (a plus b,
the total of xs, x is at least 10). subexpressions collects the
parts worth showing a runtime value for — named things and computations,
never literals (already visible in the rendered text) — so a failed
Expect can annotate each with its actual value.
Functions§
- render_
expr - Render an expression as source-like English. Exotic shapes fall back to an ellipsis rather than panicking — a failure message must never crash.
- subexpressions
- The subexpressions worth showing a runtime value for, in a stable order: the whole expression’s interesting operands and their operands, depth-first, EXCLUDING bare literals (already visible in the rendered text). Used to build a failed expectation’s power-assert annotations.