mirror of
https://github.com/powdr-labs/powdr.git
synced 2026-04-20 03:03:25 -04:00
Merge pull request #853 from powdr-labs/run_importer_and_resolver_in_tests
Run importer and resolver in tests.
This commit is contained in:
@@ -16,6 +16,7 @@ type_check = { path = "../type_check" }
|
||||
|
||||
[dev-dependencies]
|
||||
parser = { path = "../parser" }
|
||||
importer = { path = "../importer" }
|
||||
pretty_assertions = "1.3.0"
|
||||
test-log = "0.2.12"
|
||||
env_logger = "0.10.0"
|
||||
|
||||
@@ -62,11 +62,11 @@ pub mod utils {
|
||||
#[cfg(test)]
|
||||
mod test_util {
|
||||
use ast::asm_analysis::AnalysisASMFile;
|
||||
use importer::resolve_str;
|
||||
use number::FieldElement;
|
||||
use parser::parse_asm;
|
||||
|
||||
/// A test utility to process a source file until after type checking
|
||||
pub fn typecheck_str<T: FieldElement>(source: &str) -> Result<AnalysisASMFile<T>, Vec<String>> {
|
||||
type_check::check(parse_asm(None, source).unwrap())
|
||||
type_check::check(resolve_str(source))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,12 +173,12 @@ mod tests {
|
||||
|
||||
let batched: AnalysisASMFile<GoldilocksField> = batch_str(&input);
|
||||
|
||||
assert_eq!(
|
||||
format!("{batched}")
|
||||
.replace("\n\n", "\n")
|
||||
.replace('\t', " "),
|
||||
expected.replace("\n\n", "\n").replace('\t', " "),
|
||||
);
|
||||
let result = format!("{batched}").replace("\n\n", "\n");
|
||||
let expected = expected.replace("\n\n", "\n");
|
||||
// The stdlib is added by the importer, so we only check for the initial part.
|
||||
assert!(result.len() >= expected.len());
|
||||
assert!(expected.len() >= 50);
|
||||
assert_eq!(result[..expected.len()], expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user