1
0

Add test for root node

This commit is contained in:
Jeff 2024-02-16 10:23:33 -05:00
parent 50a7a7aca1
commit 51869f04b6
2 changed files with 29 additions and 14 deletions

View File

@ -30,17 +30,3 @@ fn async_with_return() {
Ok(Value::Integer(1)) Ok(Value::Integer(1))
); );
} }
#[test]
fn root_returns_like_block() {
assert_eq!(
interpret(
"
return 1
1 + 1
3
"
),
Ok(Value::Integer(1))
);
}

29
tests/root.rs Normal file
View File

@ -0,0 +1,29 @@
use dust_lang::*;
#[test]
fn returns_final_statement() {
assert_eq!(
interpret(
"
1
1 + 1
3
"
),
Ok(Value::Integer(3))
);
}
#[test]
fn return_statement() {
assert_eq!(
interpret(
"
return 1
1 + 1
3
"
),
Ok(Value::Integer(1))
);
}