* fixed and wrote test for lambda and function as arg case

* added license to userlib tests
* added map impl to userlib
* userlib tests now run and pass
* all args are evaluated individually
This commit is contained in:
Ava Apples Affine 2023-03-20 16:22:51 -07:00
parent 8a91560921
commit dcb2969b0a
Signed by: affine
GPG key ID: 3A4645B8CF806069
7 changed files with 148 additions and 40 deletions

View file

@ -252,7 +252,7 @@ mod func_tests {
syms.call_symbol(&"test_func_in".to_string(), &args, true)
.err()
.unwrap(),
"error in call to undefined-symbol: undefined symbol: undefined-symbol".to_string(),
"error evaluating args: undefined symbol: undefined-symbol".to_string(),
);
}
}

View file

@ -335,6 +335,26 @@ mod decl_lib_tests {
}
}
#[test]
fn test_lambda_arg_call() {
let document = "(let (())
(def appl '' (func item) (func item))
(def adder 'my adder' (lambda (x) (add x 1)))
(appl adder 2))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap();
let it = *eval(
&lex(&document.to_string()).unwrap(),
&mut syms).unwrap();
if let Ctr::Integer(i) = it {
assert_eq!(i, 3)
} else {
println!("bad result: {}", it);
panic!()
}
}
#[test]
fn test_setget_doc_string() {
let highly_inadvisable = "(set-doc (q help) 'help')";