FEATURE: output the parse or build errors of assert statements.

This commit is contained in:
Jeremy Wall 2018-08-29 20:12:54 -05:00
parent 0003e1b9c3
commit d288924fbb

View File

@ -991,11 +991,15 @@ impl<'a> Builder<'a> {
let ok = match self.eval_string(&expr_as_stmt) {
Ok(v) => v,
Err(e) => {
return Err(Box::new(error::Error::new(
format!("Assertion Evaluation of [{}] failed: {}", expr, e),
error::ErrorType::AssertError,
tok.pos.clone(),
)));
// failure!
let msg = format!(
"NOT OK - '{}' at line: {} column: {}\n\tCompileError: {}\n",
expr, tok.pos.line, tok.pos.column, e
);
self.assert_collector.summary.push_str(&msg);
self.assert_collector.failures.push_str(&msg);
self.assert_collector.success = false;
return Ok(Rc::new(Val::Empty));
}
};