feat(ast): Add graph output
This commit is contained in:
@@ -654,6 +654,7 @@ mod tests {
|
||||
use std::io::BufRead;
|
||||
use std::path::Path;
|
||||
use std::fs::File;
|
||||
use crate::ast::graph::AstGraphExt;
|
||||
use crate::frontend::lexer::Lexer;
|
||||
use crate::utils::case_list::CaseList;
|
||||
use crate::utils::num_sequence::NumberSequence;
|
||||
@@ -686,7 +687,10 @@ mod tests {
|
||||
is_error = true;
|
||||
}
|
||||
let mut parser = Parser::new(tokens, diagnostics);
|
||||
let _compile_unit = parser.parse_compile_unit();
|
||||
let compile_unit = parser.parse_compile_unit();
|
||||
let dot = compile_unit.to_dot();
|
||||
let case_name = case_list.get_case_name(case_no).unwrap().strip_suffix(".c").unwrap();
|
||||
std::fs::write(format!("output/{}.dot", case_name), dot).unwrap();
|
||||
if !parser.diagnostics.is_empty() {
|
||||
parser.diagnostics.print(&format!("{}", case_path.display()), &full_text);
|
||||
is_error = true;
|
||||
|
||||
Reference in New Issue
Block a user