add more failing tests

This commit is contained in:
nora 2022-04-24 20:13:21 +02:00
parent 386ed99810
commit c916611bdc
2 changed files with 44 additions and 1 deletions

View file

@ -475,7 +475,6 @@ impl<'bc, 'gc> Compiler<'bc, 'gc> {
for param in params.iter() { for param in params.iter() {
self.compile_expr(param)?; self.compile_expr(param)?;
todo!("no params yet")
} }
self.push_instr(Instr::Load(offset), StackChange::Grow, call.span); self.push_instr(Instr::Load(offset), StackChange::Grow, call.span);

View file

@ -41,3 +41,47 @@ test2();
print "correct3"; print "correct3";
"# "#
); );
run_test!(
parameters,
r#"
fn fancy_print(str) {
print str;
}
fancy_print("correct");
"#
);
run_test!(
parameters_and_return,
r#"
fn add(a, b) {
return a + b;
}
let added = add(1, 5);
if added == 6 {
print "correct";
} else {
print "FAILED";
}
"#
);
run_test!(
fib5,
r#"
fn fib(n) {
if n < 2 {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
let fib5 = fib(5);
print fib5;
"#
);