From d4eae685a373316dd9c1f2cb6d0123865cca541f Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 30 Jul 2020 16:27:31 -0700 Subject: [PATCH] fix macros tests --- compiler/tests/macros/mod.rs | 25 ++++++++++++++----------- compiler/tests/macros/print_input.leo | 4 ++-- compiler/tests/mod.rs | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/compiler/tests/macros/mod.rs b/compiler/tests/macros/mod.rs index ce581af148..9a4c1698d7 100644 --- a/compiler/tests/macros/mod.rs +++ b/compiler/tests/macros/mod.rs @@ -1,4 +1,4 @@ -use crate::{get_error, get_output, parse_program}; +use crate::{assert_satisfied, expect_compiler_error, generate_main_inputs, parse_program}; use leo_types::InputValue; #[test] @@ -6,7 +6,7 @@ fn test_print() { let bytes = include_bytes!("print.leo"); let program = parse_program(bytes).unwrap(); - let _output = get_output(program); + assert_satisfied(program); } #[test] @@ -21,7 +21,7 @@ fn test_print_parameter() { let bytes = include_bytes!("print_parameter.leo"); let program = parse_program(bytes).unwrap(); - let _output = get_output(program); + assert_satisfied(program); } #[test] @@ -29,7 +29,7 @@ fn test_print_parameter_many() { let bytes = include_bytes!("print_parameter_many.leo"); let program = parse_program(bytes).unwrap(); - let _output = get_output(program); + assert_satisfied(program); } #[test] @@ -37,7 +37,7 @@ fn test_print_parameter_fail_unknown() { let bytes = include_bytes!("print_parameter_fail_unknown.leo"); let program = parse_program(bytes).unwrap(); - let _err = get_error(program); + expect_compiler_error(program); } #[test] @@ -45,7 +45,7 @@ fn test_print_parameter_fail_empty() { let bytes = include_bytes!("print_parameter_fail_empty.leo"); let program = parse_program(bytes).unwrap(); - let _err = get_error(program); + expect_compiler_error(program); } #[test] @@ -53,7 +53,7 @@ fn test_print_parameter_fail_none() { let bytes = include_bytes!("print_parameter_fail_empty.leo"); let program = parse_program(bytes).unwrap(); - let _err = get_error(program); + expect_compiler_error(program); } #[test] @@ -61,9 +61,11 @@ fn test_print_input() { let bytes = include_bytes!("print_input.leo"); let mut program = parse_program(bytes).unwrap(); - program.set_main_inputs(vec![Some(InputValue::Boolean(true))]); + let main_inputs = generate_main_inputs(vec![("a", Some(InputValue::Boolean(true)))]); - let _output = get_output(program); + program.set_main_inputs(main_inputs); + + assert_satisfied(program); } #[test] @@ -71,12 +73,13 @@ fn test_debug() { let bytes = include_bytes!("debug.leo"); let program = parse_program(bytes).unwrap(); - let _output = get_output(program); + assert_satisfied(program); } + #[test] fn test_error() { let bytes = include_bytes!("error.leo"); let program = parse_program(bytes).unwrap(); - let _output = get_output(program); + assert_satisfied(program); } diff --git a/compiler/tests/macros/print_input.leo b/compiler/tests/macros/print_input.leo index 8190a6621f..fa307720ab 100644 --- a/compiler/tests/macros/print_input.leo +++ b/compiler/tests/macros/print_input.leo @@ -1,3 +1,3 @@ -function main(b: bool) { - print!("b = {}", b); +function main(a: bool) { + print!("a = {}", a); } \ No newline at end of file diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index d4330a1402..7a9a222724 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -8,7 +8,7 @@ pub mod group; pub mod import; pub mod inputs; pub mod integers; -// pub mod macros; +pub mod macros; // pub mod mutability; // pub mod statements; // pub mod syntax;