fix syntax tests

This commit is contained in:
collin 2020-07-30 17:19:10 -07:00
parent 6eb9ef41c3
commit e62a2a066a
3 changed files with 19 additions and 12 deletions

View File

@ -154,7 +154,14 @@ impl<F: Field + PrimeField, G: GroupType<F>> Compiler<F, G> {
self,
cs: &mut CS,
) -> Result<OutputBytes, CompilerError> {
generate_constraints::<_, G, _>(cs, self.program, self.program_inputs, &self.imported_programs)
let path = self.main_file_path;
generate_constraints::<_, G, _>(cs, self.program, self.program_inputs, &self.imported_programs).map_err(
|mut error| {
error.set_path(path);
error
},
)
}
pub fn to_bytes(&self) -> Result<Vec<u8>, CompilerError> {

View File

@ -11,7 +11,7 @@ pub mod integers;
pub mod macros;
pub mod mutability;
pub mod statements;
// pub mod syntax;
pub mod syntax;
use leo_compiler::{
compiler::Compiler,
@ -66,14 +66,14 @@ pub(crate) fn parse_program(bytes: &[u8]) -> Result<EdwardsTestCompiler, Compile
Ok(compiler)
}
// pub(crate) fn parse_inputs(bytes: &[u8]) -> Result<EdwardsTestCompiler, CompilerError> {
// let mut compiler = new_compiler();
// let inputs_string = String::from_utf8_lossy(bytes);
//
// compiler.parse_inputs(&inputs_string, "")?;
//
// Ok(compiler)
// }
pub(crate) fn parse_inputs(bytes: &[u8]) -> Result<EdwardsTestCompiler, CompilerError> {
let mut compiler = new_compiler();
let inputs_string = String::from_utf8_lossy(bytes);
compiler.parse_inputs(&inputs_string, "")?;
Ok(compiler)
}
pub(crate) fn get_outputs(program: EdwardsTestCompiler) -> OutputBytes {
// synthesize the circuit on the test constraint system

View File

@ -1,4 +1,4 @@
use crate::{get_error, parse_inputs, parse_program};
use crate::{expect_compiler_error, parse_inputs, parse_program};
use leo_ast::ParserError;
use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, StatementError};
use leo_inputs::InputParserError;
@ -19,7 +19,7 @@ fn test_undefined() {
let bytes = include_bytes!("undefined.leo");
let program = parse_program(bytes).unwrap();
let error = get_error(program);
let error = expect_compiler_error(program);
match error {
CompilerError::FunctionError(FunctionError::StatementError(StatementError::ExpressionError(