Formatting.
This commit is contained in:
13
build.rs
13
build.rs
@@ -58,6 +58,11 @@ fn generate_tests(f: &mut File, path_so_far: PathBuf) -> std::io::Result<()> {
|
||||
" assert_ne!(errors.len(), 0, \"should have seen an error\");"
|
||||
)?;
|
||||
} else {
|
||||
// NOTE: Since the advent of defaulting rules and type checking, we
|
||||
// can't guarantee that syntax.eval() will return the same result as
|
||||
// ir.eval() or backend::eval(). We must do type checking to force
|
||||
// constants into the right types, first. So this now checks only that
|
||||
// the result of ir.eval() and backend::eval() are the same.
|
||||
writeln!(
|
||||
f,
|
||||
" let syntax = syntax.expect(\"file should have parsed\");"
|
||||
@@ -67,17 +72,13 @@ fn generate_tests(f: &mut File, path_so_far: PathBuf) -> std::io::Result<()> {
|
||||
f,
|
||||
" assert_eq!(errors.len(), 0, \"file should have no validation errors\");"
|
||||
)?;
|
||||
writeln!(f, " let syntax_result = syntax.eval();")?;
|
||||
writeln!(
|
||||
f,
|
||||
" let ir = syntax.type_infer().expect(\"example is typed correctly\");"
|
||||
)?;
|
||||
writeln!(
|
||||
f,
|
||||
" assert_eq!(syntax_result, ir.eval(), \"syntax equivalent to IR\");"
|
||||
)?;
|
||||
writeln!(f, " let ir_result = ir.eval();")?;
|
||||
writeln!(f, " let compiled_result = Backend::<JITModule>::eval(ir);")?;
|
||||
writeln!(f, " assert_eq!(syntax_result, compiled_result);")?;
|
||||
writeln!(f, " assert_eq!(ir_result, compiled_result);")?;
|
||||
}
|
||||
writeln!(f, "}}")?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user