Fix recursive file import bug.

This commit is contained in:
Stephen Chung
2020-11-08 23:00:03 +08:00
parent 232ba27548
commit 487a073caf
4 changed files with 46 additions and 19 deletions

View File

@@ -432,3 +432,16 @@ fn test_module_ast_namespace2() -> Result<(), Box<EvalAltResult>> {
Ok(())
}
#[test]
fn test_module_file() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let ast = engine.compile(
r#"
import "scripts/module";
print("top");
"#,
)?;
Module::eval_ast_as_new(Default::default(), &ast, &engine)?;
Ok(())
}