Skip to content

Commit

Permalink
Merge pull request #944 from taichi-ishitani/clear_symbol_table
Browse files Browse the repository at this point in the history
Clear symbol table before running unit tests for analyzer
  • Loading branch information
dalance authored Sep 6, 2024
2 parents 801ab8f + 3c14a7d commit a4f914f
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions crates/analyzer/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use crate::{Analyzer, AnalyzerError};
use crate::{symbol_table, Analyzer, AnalyzerError};
use veryl_metadata::Metadata;
use veryl_parser::Parser;

#[track_caller]
fn analyze(code: &str) -> Vec<AnalyzerError> {
symbol_table::clear();

let metadata: Metadata =
toml::from_str(&Metadata::create_default_toml("prj").unwrap()).unwrap();
let parser = Parser::parse(&code, &"").unwrap();
Expand Down Expand Up @@ -1676,18 +1678,6 @@ fn unused_variable() {

let errors = analyze(code);
assert!(matches!(errors[0], AnalyzerError::UnusedVariable { .. }));

let code = r#"
module ModuleC {
always_comb {
var a: logic;
a = 1;
}
}
"#;

let errors = analyze(code);
assert!(matches!(errors[0], AnalyzerError::UnusedVariable { .. }));
}

#[test]
Expand Down

0 comments on commit a4f914f

Please sign in to comment.