added env function and test

This commit is contained in:
Ava Hahn 2023-03-06 15:50:02 -08:00
parent 79184b18ef
commit f22d807b57
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
5 changed files with 55 additions and 1 deletions

View file

@ -249,4 +249,20 @@ mod var_lib_tests {
assert!(!b);
}
}
#[test]
fn test_env_doesnt_lose_elements() {
let doc1 = "(def t '' 1)";
let doc2 = "(env)";
let doc3 = "t";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap();
let set_tree = lex(&doc1.to_string()).unwrap();
let env_tree = lex(&doc2.to_string()).unwrap();
let tst_tree = lex(&doc3.to_string()).unwrap();
eval(&set_tree, &mut syms).unwrap();
eval(&env_tree, &mut syms).unwrap();
eval(&tst_tree, &mut syms).unwrap();
}
}