all tests green
Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
parent
82854a58f8
commit
93a1e06a53
5 changed files with 94 additions and 32 deletions
|
|
@ -45,7 +45,7 @@ mod func_tests {
|
|||
#[test]
|
||||
fn decl_and_call_external_func_singlet() {
|
||||
let mut syms = SymTable::new();
|
||||
match lex(&"((input))".to_string()) {
|
||||
match lex(&"input".to_string()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
Ok(finner) => {
|
||||
let test_external_func: Symbol = Symbol {
|
||||
|
|
@ -85,7 +85,7 @@ mod func_tests {
|
|||
#[test]
|
||||
fn decl_and_call_external_func_multi_body() {
|
||||
let mut syms = SymTable::new();
|
||||
match lex(&"((input) (input))".to_string()) {
|
||||
match lex(&"(input input)".to_string()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
Ok(finner) => {
|
||||
let test_external_func: Symbol = Symbol{
|
||||
|
|
@ -106,7 +106,7 @@ mod func_tests {
|
|||
syms.insert(String::from("echo_2"), test_external_func);
|
||||
|
||||
match syms.call_symbol(&"echo_2".to_string(), &args, true) {
|
||||
Ok(ret) => assert_eq!(ret.to_string(), "(\"test\" \"test\")"),
|
||||
Ok(ret) => assert_eq!(ret.to_string(), "'test'"),
|
||||
Err(e) => {
|
||||
print!("Call to function failed: {}\n", e);
|
||||
assert!(false);
|
||||
|
|
@ -213,7 +213,7 @@ mod func_tests {
|
|||
#[test]
|
||||
fn too_many_args() {
|
||||
let mut syms = SymTable::new();
|
||||
match lex(&"((input))".to_string()) {
|
||||
match lex(&"(input)".to_string()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
Ok(finner) => {
|
||||
let test_external_func: Symbol = Symbol {
|
||||
|
|
@ -246,7 +246,7 @@ mod func_tests {
|
|||
#[test]
|
||||
fn too_few_args() {
|
||||
let mut syms = SymTable::new();
|
||||
match lex(&"((input))".to_string()) {
|
||||
match lex(&"(input)".to_string()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
Ok(finner) => {
|
||||
let test_external_func: Symbol = Symbol {
|
||||
|
|
@ -263,7 +263,7 @@ mod func_tests {
|
|||
syms.insert(String::from("test_func_in"), test_external_func);
|
||||
|
||||
if let Err(s) = syms.call_symbol(&"test_func_in".to_string(), &args, true) {
|
||||
assert_eq!(s, "failure to call echo: expected 1 args. Got 2.");
|
||||
assert_eq!(s, "failure to call echo: expected 1 args. Got 0.");
|
||||
} else {
|
||||
print!("call to function succeeded (shouldnt have)");
|
||||
assert!(false);
|
||||
|
|
@ -298,7 +298,7 @@ mod func_tests {
|
|||
syms.insert(String::from("test_func_in"), test_internal_func);
|
||||
|
||||
if let Err(s) = syms.call_symbol(&"test_func_in".to_string(), &args, true) {
|
||||
assert_eq!(s, "failure to call echo: expected 1 args. Got 2.");
|
||||
assert_eq!(s, "error in call to undefined-symbol: undefined symbol: undefined-symbol");
|
||||
} else {
|
||||
print!("call to function succeeded (shouldnt have)");
|
||||
assert!(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue