Skip to main content

error_expect

Function error_expect 

Source
pub fn error_expect(expected: &str) -> Result<ErrorExpect>
Expand description

Read an error expectation.

ERROR                     any error
ERROR:unexpected          that code, position unchecked
ERROR:unexpected@1:8      that code, reported at row 1 col 8
ERROR:@1:8                any code, reported at row 1 col 8

The position channel exists because a code alone does not pin a diagnostic. Two runtimes can agree on unexpected and disagree on where they say it happened, which is exactly what the fleet audit found, in several repos at once, with every code row green. A fixture that pins the position makes that disagreement a failing row instead of a difference nobody is looking at.

@ rather than another colon because a code is not always a bare identifier: the fleet’s fixtures already carry ERROR:a:b and whole diagnostic sentences with embedded colons, so ERROR:x:1:8 could not be split without guessing. Anchoring at the end and requiring digits keeps a message that merely CONTAINS an @ intact.

An error when handed a cell that is not an error expectation at all.