sketch a bit more; going to pull this out of tests next
This commit is contained in:
@ -2211,4 +2211,43 @@ a = foo()
|
||||
let result = parse_execute(program).await;
|
||||
assert!(result.unwrap_err().to_string().contains("return"));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn load_all_modules() {
|
||||
let mut universe = HashMap::<String, NodeRef<'_, Program>>::new();
|
||||
|
||||
// program a.kcl
|
||||
let programa = r#"
|
||||
a = 1
|
||||
"#;
|
||||
let programa = crate::parsing::parse_str(&programa, ModuleId::default())
|
||||
.parse_errs_as_err()
|
||||
.unwrap();
|
||||
universe.insert("a.kcl".to_owned(), (&programa).into());
|
||||
|
||||
// program b.kcl
|
||||
let programb = r#"
|
||||
import 'a.kcl' as x
|
||||
"#;
|
||||
let programb = crate::parsing::parse_str(&programb, ModuleId::default())
|
||||
.parse_errs_as_err()
|
||||
.unwrap();
|
||||
universe.insert("b.kcl".to_owned(), (&programb).into());
|
||||
|
||||
// program c.kcl
|
||||
let programc = r#"
|
||||
import 'a.kcl'
|
||||
"#;
|
||||
let programc = crate::parsing::parse_str(&programc, ModuleId::default())
|
||||
.parse_errs_as_err()
|
||||
.unwrap();
|
||||
universe.insert("c.kcl".to_owned(), (&programc).into());
|
||||
|
||||
// ok we have all the "files" loaded, let's do a sort and concurrent
|
||||
// run here.
|
||||
|
||||
for modules in crate::walk::import_graph(universe).into_iter() {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ pub mod std;
|
||||
pub mod test_server;
|
||||
mod thread;
|
||||
mod unparser;
|
||||
mod walk;
|
||||
pub mod walk;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod wasm;
|
||||
|
||||
|
@ -8,3 +8,4 @@ mod import_graph;
|
||||
pub use ast_node::Node;
|
||||
pub use ast_visitor::Visitable;
|
||||
pub use ast_walk::walk;
|
||||
pub use import_graph::import_graph;
|
||||
|
Reference in New Issue
Block a user