Add test for return value.

This commit is contained in:
nora 2022-05-30 18:49:05 +02:00
parent 3ac2746658
commit eaa2f3527c
4 changed files with 24 additions and 0 deletions

View file

@ -4,3 +4,9 @@ fn test() {
test();
test();
let i = 0;
while i < 100_000 {
test();
i = i + 1;
}

View file

@ -17,6 +17,7 @@ pub fn _run_test(code: &str) -> String {
debug: false,
step: false,
stdout: &mut stdout,
parse_only: false,
};
dilaria::run_program(code, &mut cfg);

View file

@ -54,6 +54,18 @@ fancy_print("correct");
"#
);
run_test!(
return_value,
r#"
fn get_value() {
return 1;
}
let x = get_value();
print x;
"#
);
run_test!(
#[ignore]
parameters_and_return,

View file

@ -0,0 +1,5 @@
---
source: tests/functions.rs
expression: output
---
"1\n"