diff --git a/nac3core/src/toplevel/test.rs b/nac3core/src/toplevel/test.rs index a270eb0b4..3dd260ce8 100644 --- a/nac3core/src/toplevel/test.rs +++ b/nac3core/src/toplevel/test.rs @@ -8,8 +8,12 @@ use crate::{ }, }; use indoc::indoc; +use parking_lot::RwLock; use rustpython_parser::{ast::fold::Fold, parser::parse_program}; -use std::collections::{HashMap, HashSet}; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, +}; use test_case::test_case; use super::TopLevelComposer; @@ -20,6 +24,12 @@ struct Resolver { class_names: HashMap, } +impl Resolver { + pub fn add_id_def(&mut self, id: String, def: DefinitionId) { + self.id_to_def.insert(id, def); + } +} + impl SymbolResolver for Resolver { fn get_symbol_type(&self, _: &mut Unifier, _: &PrimitiveStore, str: &str) -> Option { self.id_to_type.get(str).cloned() @@ -60,6 +70,12 @@ impl SymbolResolver for Resolver { indoc! {" def foo(a: float): a + 1.0 + "}, + indoc! {" + class C(B): + def __init__(self): + self.c: int = 4 + self.a: bool = True "} ] )]