Skip to main content

parse_expect

Function parse_expect 

Source
pub fn parse_expect(expected: &str) -> Result<Value>
Expand description

Parse an expected cell as JSON. An empty cell is Value::Undefined, the fixture convention for “no value”, as in a utility whose result is nothing at all.

The cell is NOT escape-decoded first: it is JSON, and JSON has its own escape rules. Decoding it here would turn the two characters \n inside a JSON string into a real newline, which is not valid JSON.

A number too large for an f64 (1e400) reads as an infinity, which is what the canonical JSON.parse answers, so a row that loads in TypeScript loads here too.