From 05a9046a7f10f8a6bc4cf5e53c01abdcc0d146cd Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Thu, 22 Aug 2024 19:35:21 +0800 Subject: [PATCH] Restore unit tests --- src/compiler/compiler.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/compiler/compiler.rs b/src/compiler/compiler.rs index ab8751bf..f4d80d20 100644 --- a/src/compiler/compiler.rs +++ b/src/compiler/compiler.rs @@ -562,7 +562,7 @@ mod test { use itertools::Itertools; use crate::{ - compiler::{compile, compile_legacy}, + compiler::{compile, compile_file, compile_legacy}, parser::ast::debug_sym_factory::DebugSymRefFactory, wit_gen::TraceGenerator, }; @@ -824,4 +824,24 @@ mod test { } } } + + #[test] + fn test_compiler_fibo_file() { + let path = "test/circuit.chiquito"; + let result = compile_file::(path, Config::default().max_degree(2)); + assert!(result.is_ok()); + } + + #[test] + fn test_compiler_fibo_file_err() { + let path = "test/circuit_error.chiquito"; + let result = compile_file::(path, Config::default().max_degree(2)); + + assert!(result.is_err()); + + assert_eq!( + format!("{:?}", result.unwrap_err()), + r#"[SemErr { msg: "use of undeclared variable c", dsym: test/circuit_error.chiquito:24:39 }, SemErr { msg: "use of undeclared variable c", dsym: test/circuit_error.chiquito:28:46 }]"# + ) + } }