diff --git a/compiler/tests/core/mod.rs b/compiler/tests/core/mod.rs index a520d60ac5..6a7728361e 100644 --- a/compiler/tests/core/mod.rs +++ b/compiler/tests/core/mod.rs @@ -16,38 +16,38 @@ pub mod packages; -use crate::{assert_satisfied, expect_compiler_error, parse_program}; +use crate::{assert_satisfied, expect_static_check_error, parse_program}; #[test] fn test_core_circuit_invalid() { let program_bytes = include_bytes!("core_package_invalid.leo"); - let program = parse_program(program_bytes).unwrap(); + let program = parse_program(program_bytes).err().unwrap(); - expect_compiler_error(program); + expect_static_check_error(program); } #[test] fn test_core_circuit_star_fail() { let program_bytes = include_bytes!("core_circuit_star_fail.leo"); - let program = parse_program(program_bytes).unwrap(); + let error = parse_program(program_bytes).err().unwrap(); - expect_compiler_error(program); + expect_static_check_error(error); } #[test] fn test_core_package_invalid() { let program_bytes = include_bytes!("core_package_invalid.leo"); - let program = parse_program(program_bytes).unwrap(); + let error = parse_program(program_bytes).err().unwrap(); - expect_compiler_error(program); + expect_static_check_error(error); } #[test] fn test_core_unstable_package_invalid() { let program_bytes = include_bytes!("core_unstable_package_invalid.leo"); - let program = parse_program(program_bytes).unwrap(); + let error = parse_program(program_bytes).err().unwrap(); - expect_compiler_error(program); + expect_static_check_error(error); } #[test] diff --git a/compiler/tests/core/packages/unstable/blake2s/mod.rs b/compiler/tests/core/packages/unstable/blake2s/mod.rs index 13de62b45a..3cf5e54993 100644 --- a/compiler/tests/core/packages/unstable/blake2s/mod.rs +++ b/compiler/tests/core/packages/unstable/blake2s/mod.rs @@ -17,6 +17,7 @@ use crate::{ assert_satisfied, expect_compiler_error, + expect_dynamic_check_error, generate_main_input, get_output, parse_program, @@ -33,9 +34,9 @@ use snarkos_models::algorithms::PRF; #[test] fn test_arguments_length_fail() { let program_bytes = include_bytes!("arguments_length_fail.leo"); - let program = parse_program(program_bytes).unwrap(); + let error = parse_program(program_bytes).err().unwrap(); - expect_compiler_error(program); + expect_dynamic_check_error(error); } #[test] diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index ac6d042a87..f601c2cb0b 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -187,6 +187,15 @@ pub(crate) fn expect_dynamic_check_error(error: CompilerError) { assert!(is_dynamic_check) } +pub(crate) fn expect_static_check_error(error: CompilerError) { + let is_static_check = match error { + CompilerError::StaticCheckError(_) => true, + _ => false, + }; + + assert!(is_static_check) +} + // pub(crate) fn expect_synthesis_error(program: EdwardsTestCompiler) { // let mut cs = TestConstraintSystem::::new(); // let _output = program.generate_constraints_helper(&mut cs).unwrap();