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) { let ok = match self.eval_string(&expr_as_stmt) {
Ok(v) => v, Ok(v) => v,
Err(e) => { Err(e) => {
return Err(Box::new(error::Error::new( // failure!
format!("Assertion Evaluation of [{}] failed: {}", expr, e), let msg = format!(
error::ErrorType::AssertError, "NOT OK - '{}' at line: {} column: {}\n\tCompileError: {}\n",
tok.pos.clone(), 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));
} }
}; };