diff --git a/compiler/tests/input_files/program_input_and_program_state/mod.rs b/compiler/tests/input_files/program_input_and_program_state/mod.rs index c80bd98b7b..302f6fd433 100644 --- a/compiler/tests/input_files/program_input_and_program_state/mod.rs +++ b/compiler/tests/input_files/program_input_and_program_state/mod.rs @@ -18,27 +18,27 @@ use crate::{assert_satisfied, parse_input_and_state, parse_program_with_input_an #[test] fn test_basic() { - let input_bytes = include_bytes!("input/basic.in"); - let state_bytes = include_bytes!("input/basic.state"); + let input_string = include_str!("input/basic.in"); + let state_string = include_str!("input/basic.state"); - parse_input_and_state(input_bytes, state_bytes).unwrap(); + parse_input_and_state(input_string, state_string).unwrap(); } #[test] fn test_full() { - let input_bytes = include_bytes!("input/token_withdraw.in"); - let state_bytes = include_bytes!("input/token_withdraw.state"); + let input_string = include_str!("input/token_withdraw.in"); + let state_string = include_str!("input/token_withdraw.state"); - parse_input_and_state(input_bytes, state_bytes).unwrap(); + parse_input_and_state(input_string, state_string).unwrap(); } #[test] fn test_access() { - let program_bytes = include_bytes!("access.leo"); - let input_bytes = include_bytes!("input/token_withdraw.in"); - let state_bytes = include_bytes!("input/token_withdraw.state"); + let program_string = include_str!("access.leo"); + let input_string = include_str!("input/token_withdraw.in"); + let state_string = include_str!("input/token_withdraw.state"); - let program = parse_program_with_input_and_state(program_bytes, input_bytes, state_bytes).unwrap(); + let program = parse_program_with_input_and_state(program_strin, input_string, state_string).unwrap(); assert_satisfied(program); } diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index da31698251..2b7aa6bef0 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -73,12 +73,11 @@ pub(crate) fn parse_program(bytes: &[u8]) -> Result Result { +pub(crate) fn parse_input(input_string: &str) -> Result { let mut compiler = new_compiler(); - let input_string = String::from_utf8_lossy(bytes); let path = PathBuf::new(); - compiler.parse_input(&input_string, &path, EMPTY_FILE, &path)?; + compiler.parse_input(input_string, &path, EMPTY_FILE, &path)?; Ok(compiler) } @@ -87,21 +86,19 @@ pub(crate) fn parse_state(state_string: &str) -> Result Result { let mut compiler = new_compiler(); - let input_string = String::from_utf8_lossy(input_bytes); - let state_string = String::from_utf8_lossy(state_bytes); let path = PathBuf::new(); - compiler.parse_input(&input_string, &path, &state_string, &path)?; + compiler.parse_input(input_string, &path, state_string, &path)?; Ok(compiler) } @@ -127,9 +124,6 @@ pub fn parse_program_with_state( state_string: &str, ) -> Result { let mut compiler = new_compiler(); - - // let program_string = String::from_utf8_lossy(program_bytes); - // let state_string = String::from_utf8_lossy(state_bytes); let path = PathBuf::new(); compiler.parse_input(EMPTY_FILE, &path, state_string, &path)?; @@ -139,18 +133,14 @@ pub fn parse_program_with_state( } pub fn parse_program_with_input_and_state( - program_bytes: &[u8], - input_bytes: &[u8], - state_bytes: &[u8], + program_string: &str, + input_string: &str, + state_string: &str, ) -> Result { let mut compiler = new_compiler(); - - let program_string = String::from_utf8_lossy(program_bytes); - let input_string = String::from_utf8_lossy(input_bytes); - let state_string = String::from_utf8_lossy(state_bytes); let path = PathBuf::new(); - compiler.parse_input(&input_string, &path, &state_string, &path)?; + compiler.parse_input(input_string, &path, state_string, &path)?; compiler.parse_program_from_string(&program_string)?; Ok(compiler) diff --git a/compiler/tests/syntax/mod.rs b/compiler/tests/syntax/mod.rs index 55b7292d2a..a4fd56f095 100644 --- a/compiler/tests/syntax/mod.rs +++ b/compiler/tests/syntax/mod.rs @@ -63,10 +63,9 @@ fn test_undefined() { } #[test] -#[ignore] fn input_syntax_error() { - let bytes = include_bytes!("input_semicolon.leo"); - let error = parse_input(bytes).err().unwrap(); + let input_string = include_str!("input_semicolon.leo"); + let error = parse_input(input_string).err().unwrap(); // Expect an input parser error. match error {