No need to merge module if empty.

This commit is contained in:
Stephen Chung
2020-09-30 09:57:21 +08:00
parent c7dfbd48a6
commit e526b53b42
2 changed files with 97 additions and 42 deletions

View File

@@ -237,6 +237,9 @@ fn test_module_from_ast() -> Result<(), Box<EvalAltResult>> {
fn add_len(x, y) {
x + len(y)
}
fn cross_call(x) {
calc(x)
}
private fn hidden() {
throw "you shouldn't see me!";
}
@@ -285,6 +288,10 @@ fn test_module_from_ast() -> Result<(), Box<EvalAltResult>> {
engine.eval::<INT>(r#"import "testing" as ttt; ttt::calc(999)"#)?,
1000
);
assert_eq!(
engine.eval::<INT>(r#"import "testing" as ttt; ttt::cross_call(999)"#)?,
1000
);
assert_eq!(
engine.eval::<INT>(r#"import "testing" as ttt; ttt::add_len(ttt::foo, ttt::hello)"#)?,
59