Enable warnings for failing tests

This commit is contained in:
Pranav Gaddamadugu 2023-04-03 11:15:07 -07:00
parent a909a31dbf
commit 37fe6f5bb1
3 changed files with 9 additions and 5 deletions

View File

@ -50,8 +50,9 @@ impl Namespace for CompileNamespace {
fn run_test(&self, test: Test) -> Result<Value, String> {
let buf = BufferEmitter(Rc::default(), Rc::default());
let handler = Handler::new(Box::new(buf.clone()));
create_session_if_not_set_then(|_| run_test(test, &handler).map_err(|()| buf.0.take().to_string()))
create_session_if_not_set_then(|_| {
run_test(test, &handler).map_err(|()| buf.0.take().to_string() + &buf.1.take().to_string())
})
}
}

View File

@ -56,8 +56,9 @@ impl Namespace for ExecuteNamespace {
fn run_test(&self, test: Test) -> Result<Value, String> {
let buf = BufferEmitter(Rc::default(), Rc::default());
let handler = Handler::new(Box::new(buf.clone()));
create_session_if_not_set_then(|_| run_test(test, &handler, &buf).map_err(|()| buf.0.take().to_string()))
create_session_if_not_set_then(|_| {
run_test(test, &handler, &buf).map_err(|()| buf.0.take().to_string() + &buf.1.take().to_string())
})
}
}

View File

@ -65,7 +65,9 @@ fn with_handler<T>(
) -> Result<T, String> {
let (handler, buf) = Handler::new_with_buf();
let mut tokens = ParserContext::new(&handler, tokens);
let parsed = handler.extend_if_error(logic(&mut tokens)).map_err(|_| buf.extract_errs().to_string())?;
let parsed = handler
.extend_if_error(logic(&mut tokens))
.map_err(|_| buf.extract_errs().to_string() + &buf.extract_warnings().to_string())?;
not_fully_consumed(&mut tokens)?;
Ok(parsed)
}