Fix bug in Scope cloning.

This commit is contained in:
Stephen Chung
2022-04-23 11:53:17 +08:00
parent 71bc605fe6
commit 5a75479119
3 changed files with 75 additions and 17 deletions

View File

@@ -79,6 +79,17 @@ fn test_var_scope() -> Result<(), Box<EvalAltResult>> {
);
}
scope.clear();
scope.push("x", 42 as INT);
scope.push_constant("x", 42 as INT);
let scope2 = scope.clone();
let scope3 = scope.clone_visible();
assert_eq!(scope2.is_constant("x"), Some(true));
assert_eq!(scope3.is_constant("x"), Some(true));
Ok(())
}