fix append func

Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
Ava Hahn 2023-02-28 09:59:33 -08:00
parent 09e3546ba6
commit 452cb7a654
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
2 changed files with 27 additions and 5 deletions

View file

@ -20,6 +20,24 @@ mod append_lib_tests {
}
}
#[test]
fn test_multi_append_to_empty_list() {
let document = "(append () 1 'two' 3.4)";
let result = "(1 'two' 3.4)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(false, &mut syms).unwrap();
if let Ok(tree) = lex(&document.to_string()) {
if let Ctr::Seg(ref s) = *eval(&tree, &mut syms).unwrap() {
assert_eq!(s.to_string(), result);
}
} else {
assert!(false)
}
}
#[test]
fn test_append_to_full_list() {
let document = "(append (1 2) 3)";