mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
Add test for return value.
This commit is contained in:
parent
3ac2746658
commit
eaa2f3527c
4 changed files with 24 additions and 0 deletions
6
test.dil
6
test.dil
|
|
@ -4,3 +4,9 @@ fn test() {
|
||||||
|
|
||||||
test();
|
test();
|
||||||
test();
|
test();
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
while i < 100_000 {
|
||||||
|
test();
|
||||||
|
i = i + 1;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ pub fn _run_test(code: &str) -> String {
|
||||||
debug: false,
|
debug: false,
|
||||||
step: false,
|
step: false,
|
||||||
stdout: &mut stdout,
|
stdout: &mut stdout,
|
||||||
|
parse_only: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
dilaria::run_program(code, &mut cfg);
|
dilaria::run_program(code, &mut cfg);
|
||||||
|
|
|
||||||
|
|
@ -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!(
|
run_test!(
|
||||||
#[ignore]
|
#[ignore]
|
||||||
parameters_and_return,
|
parameters_and_return,
|
||||||
|
|
|
||||||
5
tests/snapshots/functions__return_value.snap
Normal file
5
tests/snapshots/functions__return_value.snap
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
source: tests/functions.rs
|
||||||
|
expression: output
|
||||||
|
---
|
||||||
|
"1\n"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue